Преглед изворни кода

Updated tests to fix some Win32 issues

Brian Fiete пре 5 година
родитељ
комит
fbb06862b3
3 измењених фајлова са 58 додато и 0 уклоњено
  1. 7 0
      IDEHelper/Tests/BeefSpace.toml
  2. 47 0
      IDEHelper/Tests/src/Delegates.bf
  3. 4 0
      bin/test_build.bat

+ 7 - 0
IDEHelper/Tests/BeefSpace.toml

@@ -9,6 +9,10 @@ StartupProject = "Tests"
 BfOptimizationLevel = "O0"
 BfOptimizationLevel = "O0"
 IntermediateType = "ObjectAndIRCode"
 IntermediateType = "ObjectAndIRCode"
 
 
+[Configs.Debug.Linux64]
+Toolset = "GNU"
+EnableRealtimeLeakCheck = false
+
 [Configs.Test.Win64]
 [Configs.Test.Win64]
 IntermediateType = "ObjectAndIRCode"
 IntermediateType = "ObjectAndIRCode"
 COptimizationLevel = "O2"
 COptimizationLevel = "O2"
@@ -23,6 +27,9 @@ ConfigSelections = {TestsB = {Config = "Test"}}
 COptimizationLevel = "O2"
 COptimizationLevel = "O2"
 ConfigSelections = {TestsB = {Config = "Test"}}
 ConfigSelections = {TestsB = {Config = "Test"}}
 
 
+[Configs.Test.Win32]
+ConfigSelections = {TestsB = {Config = "Test"}}
+
 [Configs.TestFail.Win64]
 [Configs.TestFail.Win64]
 PreprocessorMacros = ["TESTFAIL"]
 PreprocessorMacros = ["TESTFAIL"]
 BuildKind = "Normal"
 BuildKind = "Normal"

+ 47 - 0
IDEHelper/Tests/src/Delegates.bf

@@ -32,6 +32,25 @@ namespace Tests
 			{
 			{
 				return mA + mB + a;
 				return mA + mB + a;
 			}
 			}
+
+			public void TestLambda() mut
+			{
+				delegate int(ref int a, ref int b) dlg = scope [&] (a, b) => 
+				{
+					a += 20;
+					b += 30;
+					mA++;
+					return mA + a + b;
+				};
+
+				mA = 100;
+				int testA = 8;
+				int testB = 9;
+				Test.Assert(dlg(ref testA, ref testB) == 100+1 + 20+8 + 30+9);
+				Test.Assert(testA == 28);
+				Test.Assert(testB == 39);
+				Test.Assert(mA == 101);
+			}
 		}
 		}
 
 
 		struct NonSplattable
 		struct NonSplattable
@@ -53,6 +72,30 @@ namespace Tests
 			}
 			}
 		}
 		}
 
 
+		class ClassA
+		{
+			public int mA;
+
+			public void TestLambda()
+			{
+				delegate int(ref int a, ref int b) dlg = scope (a, b) => 
+				{
+					a += 20;
+					b += 30;
+					mA++;
+					return mA + a + b;
+				};
+
+				mA = 100;
+				int testA = 8;
+				int testB = 9;
+				Test.Assert(dlg(ref testA, ref testB) == 100+1 + 20+8 + 30+9);
+				Test.Assert(testA == 28);
+				Test.Assert(testB == 39);
+				Test.Assert(mA == 101);
+			}
+		}
+
 		[Test]
 		[Test]
 		public static void TestBasics()
 		public static void TestBasics()
 		{
 		{
@@ -89,6 +132,10 @@ namespace Tests
 			dlg = scope => (ref val2).NonMutMethod;
 			dlg = scope => (ref val2).NonMutMethod;
 			Test.Assert(dlg(9) == 319);
 			Test.Assert(dlg(9) == 319);
 			Test.Assert(val2.mB == 300);
 			Test.Assert(val2.mB == 300);
+
+			val1.TestLambda();
+			ClassA ca = scope .();
+			ca.TestLambda();
 		}
 		}
 	}
 	}
 }
 }

+ 4 - 0
bin/test_build.bat

@@ -13,6 +13,10 @@ md stats
 IDE\dist\BeefBuild_d -proddir=IDEHelper\Tests -test
 IDE\dist\BeefBuild_d -proddir=IDEHelper\Tests -test
 @IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
 @IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
 
 
+@ECHO Testing IDEHelper\Tests (Win32)
+IDE\dist\BeefBuild_d -proddir=IDEHelper\Tests -test -platform=Win32
+@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
+
 @ECHO Testing SysMSVCRT
 @ECHO Testing SysMSVCRT
 del IDE\Tests\SysMSVCRT\build\Debug_Win64\SysMSVCRT\SysMSVCRT.exe
 del IDE\Tests\SysMSVCRT\build\Debug_Win64\SysMSVCRT\SysMSVCRT.exe
 IDE\dist\BeefBuild_d -proddir=IDE\Tests\SysMSVCRT
 IDE\dist\BeefBuild_d -proddir=IDE\Tests\SysMSVCRT