浏览代码

New tests

Brian Fiete 5 年之前
父节点
当前提交
cbae124dd5
共有 4 个文件被更改,包括 94 次插入5 次删除
  1. 61 4
      BeefTools/TestDLL/TestDLL.cpp
  2. 2 0
      IDE/Tests/Test1/src/Data01.bf
  3. 9 1
      IDEHelper/Tests/LibA/src/LibA0.bf
  4. 22 0
      IDEHelper/Tests/src/Extensions.bf

+ 61 - 4
BeefTools/TestDLL/TestDLL.cpp

@@ -56,7 +56,7 @@ struct StructB
 };
 
 
-struct [[nodiscard]] StructA
+struct StructA
 {
 	StructB* mSB;
 
@@ -72,7 +72,6 @@ struct [[nodiscard]] StructA
 	}
 };
 
-[[nodiscard]]
 int GetVal()
 {
 	return 9;
@@ -83,20 +82,78 @@ StructA GetSA()
 	return StructA();
 }
 
+int Zorq()
+{
+	int zaf = 123;
+	return 0;
+}
+
+struct Base
+{
+	int32_t mA;
+	int64_t mB;
+};
+
+struct Derived : Base
+{
+	int8_t mC;
+
+	int GetC()
+	{
+		return mC + 10000;
+	}
+};
+
+struct Int
+{
+	int64_t mVal;
+};
+
+void Zorq2()
+{
+	Derived dr;
+	dr.mA = 1;
+	dr.mB = 2;
+	dr.mC = 3;
+	dr.GetC();
+	Int iVal;
+	iVal.mVal = 88;
+
+	int64_t q = 999;
+}
+
+void Zorq3()
+{
+	Derived dr;
+	dr.mA = 1;
+	dr.mB = 2;
+	dr.mC = 3;	
+	Int iVal;
+	iVal.mVal = 88;
+
+	int64_t q = 999;
+}
+
 // THIS IS VERSION 6.
 extern "C"
 __declspec(dllexport) void Test2(int aa, int bb, int cc, int dd)
 {	
+	Zorq();
+	Zorq2();
+	Zorq3();
+
 	GetVal();
 	GetSA();
 
 	//Sleep(10000);
 
+	int zed = 999;
+
 	StructA sa;
 	sa.mSB = NULL;
 	Sleep(200);
-	sa.GetVal();
-	sa.GetWithSleep();	
+	//sa.GetVal();
+	//sa.GetWithSleep();	
 	//auto val = sa.mSB->mStr;
 
 	std::string str = "Hey Dude";

+ 2 - 0
IDE/Tests/Test1/src/Data01.bf

@@ -23,6 +23,8 @@ namespace IDETest
 			Derived dr = .();
 			Int iVal = (.)123;
 
+			int q = 999;
+
 			//Test_End
 		}
 	}

+ 9 - 1
IDEHelper/Tests/LibA/src/LibA0.bf

@@ -31,9 +31,17 @@ class LibClassA
 	{
 		return 9;
 	}
+
+	public static int GetVal3(Object obj)
+	{
+		return 30;
+	}
 }
 
 class LibClassB
 {
-	//public uint8* mA = append uint8[10];
+	public static int DoGetVal3<T>(T val)
+	{
+		return LibClassA.GetVal3(val);
+	}
 }

+ 22 - 0
IDEHelper/Tests/src/Extensions.bf

@@ -1,3 +1,5 @@
+#pragma warning disable 168
+
 using System;
 
 namespace System.Collections.Generic
@@ -24,6 +26,14 @@ namespace System.Collections.Generic
 	}
 }
 
+extension LibClassA
+{
+	public static int GetVal3<T>(T val)
+	{
+		return 31;
+	}
+}
+
 namespace Tests
 {
 	class Extensions
@@ -170,5 +180,17 @@ namespace Tests
 			Test.Assert(ca.LibB_GetB() == 8);
 			Test.Assert(ca.LibC_GetB() == 30013);
 		}
+
+		[Test]
+		public static void TestExtensionOverride()
+		{
+			int a = 123;
+			int directResult = LibClassA.GetVal3(a);
+			Test.Assert(directResult == 31);
+			// This should only call the LibA version since the LibA:LibClassB.DoGetVal3 won't have
+			//  access to call the Tests:LibClassB.DoGetVal3
+			int indirectResult = LibClassB.DoGetVal3(a);
+			Test.Assert(directResult == 30);
+		}
 	}
 }