mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Added some new tests
This commit is contained in:
parent
64f117b89f
commit
a3f1a33c39
5 changed files with 58 additions and 6 deletions
9
IDE/Tests/Test1/scripts/Data01.txt
Normal file
9
IDE/Tests/Test1/scripts/Data01.txt
Normal 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 }")
|
|
@ -1,3 +1,5 @@
|
|||
#pragma warning disable 168
|
||||
|
||||
using System.Threading;
|
||||
|
||||
namespace IDETest
|
||||
|
|
29
IDE/Tests/Test1/src/Data01.bf
Normal file
29
IDE/Tests/Test1/src/Data01.bf
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ namespace IDETest
|
|||
Break.Test();
|
||||
Breakpoints.Test();
|
||||
Breakpoints02.Test();
|
||||
Data01.Test();
|
||||
EnumTester.Test();
|
||||
HotTester.Test();
|
||||
HotSwap_BaseChange.Test();
|
||||
|
|
|
@ -80,20 +80,21 @@ namespace Tests
|
|||
class ClassB
|
||||
{
|
||||
[AttrA(11, 22, "StrA", "StrB")]
|
||||
int mA;
|
||||
public int mA = 1;
|
||||
[AttrB(44, 55)]
|
||||
int mB;
|
||||
int mC;
|
||||
public int mB = 2;
|
||||
public int mC = 3;
|
||||
}
|
||||
|
||||
[Reflect(.Type)]
|
||||
class ClassC
|
||||
{
|
||||
[AttrA(11, 22, "StrA", "StrC")]
|
||||
int mA;
|
||||
public int mA = 1;
|
||||
[AttrB(44, 55)]
|
||||
int mB;
|
||||
int mC;
|
||||
public int mB = 2;
|
||||
public int mC = 3;
|
||||
public float mD = 4;
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -158,6 +159,16 @@ namespace Tests
|
|||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue