1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Added some new tests

This commit is contained in:
Brian Fiete 2019-11-29 09:22:18 -08:00
parent 64f117b89f
commit a3f1a33c39
5 changed files with 58 additions and 6 deletions

View file

@ -0,0 +1,9 @@
ShowFile("src/Data01.bf")
GotoText("//Test_End")
ToggleBreakpoint()
RunWithCompiling()
AssertEvalEquals("sizeof(Derived)", "13")
AssertEvalEquals("strideof(Derived)", "16")
AssertEvalEquals("alignof(Derived)", "8")
AssertEvalEquals("iVal", "{ 123 }")

View file

@ -1,3 +1,5 @@
#pragma warning disable 168
using System.Threading; using System.Threading;
namespace IDETest namespace IDETest

View file

@ -0,0 +1,29 @@
using System;
#pragma warning disable 168
namespace IDETest
{
class Data01
{
struct Base
{
int32 mA;
int64 mB;
}
struct Derived : Base
{
int8 mC;
}
public static void Test()
{
//Test_Start
Derived dr = .();
Int iVal = (.)123;
//Test_End
}
}
}

View file

@ -8,6 +8,7 @@ namespace IDETest
Break.Test(); Break.Test();
Breakpoints.Test(); Breakpoints.Test();
Breakpoints02.Test(); Breakpoints02.Test();
Data01.Test();
EnumTester.Test(); EnumTester.Test();
HotTester.Test(); HotTester.Test();
HotSwap_BaseChange.Test(); HotSwap_BaseChange.Test();

View file

@ -80,20 +80,21 @@ namespace Tests
class ClassB class ClassB
{ {
[AttrA(11, 22, "StrA", "StrB")] [AttrA(11, 22, "StrA", "StrB")]
int mA; public int mA = 1;
[AttrB(44, 55)] [AttrB(44, 55)]
int mB; public int mB = 2;
int mC; public int mC = 3;
} }
[Reflect(.Type)] [Reflect(.Type)]
class ClassC class ClassC
{ {
[AttrA(11, 22, "StrA", "StrC")] [AttrA(11, 22, "StrA", "StrC")]
int mA; public int mA = 1;
[AttrB(44, 55)] [AttrB(44, 55)]
int mB; public int mB = 2;
int mC; public int mC = 3;
public float mD = 4;
} }
[Test] [Test]
@ -158,6 +159,16 @@ namespace Tests
fieldIdx++; fieldIdx++;
} }
let fieldInfo = cb.GetType().GetField("mC").Value;
int cVal = 0;
fieldInfo.GetValue(cb, out cVal);
fieldInfo.SetValue(cb, cVal + 1000);
Test.Assert(cb.mC == 1003);
Variant variantVal = Variant.Create(123);
fieldInfo.SetValue(cb, variantVal);
Test.Assert(cb.mC == 123);
} }
} }
} }