1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-27 03:58:01 +02:00

Fixed payload enum switch case comparison

This commit is contained in:
Brian Fiete 2023-07-24 10:32:31 -07:00
parent 52f746aae9
commit 11bde5caf2
5 changed files with 65 additions and 1 deletions

View file

@ -84,6 +84,34 @@ namespace Tests
Test.Assert(a == 1);
Test.Assert(b == 2);
ee = default;
switch (ee)
{
case default:
Test.Assert(true);
default:
Test.Assert(false);
}
ee = .B(123);
switch (ee)
{
case default:
Test.Assert(false);
default:
Test.Assert(true);
}
switch (ee)
{
case .B(100):
Test.Assert(false);
case .B(123):
Test.Assert(true);
default:
Test.Assert(false);
}
EnumF ef = .EE(.C(3, 4));
switch (ef)
{

View file

@ -239,6 +239,14 @@ namespace Tests
public float mX;
}
[CRepr]
public struct StructX
{
public int32 mA;
public int32 mB;
public char8* mC;
}
[LinkName(.C)]
public static extern int32 Func0(int32 a, int32 b);
[LinkName(.C)]
@ -307,6 +315,8 @@ namespace Tests
public static extern StructH Func2H(StructH arg0, int32 arg2);
[LinkName(.C)]
public static extern StructI Func2I(StructI arg0, int32 arg2);
[LinkName(.C)]
public static extern StructX Func2X(StructX arg0, int32 arg2);
[LinkName(.C)]
public static extern StructJ Func4J(StructJ arg0, StructJ arg1, StructJ arg2, StructJ arg3);
@ -393,6 +403,7 @@ namespace Tests
StructU su = .() { mK = .(){mX = 3, mY = 4}};
StructV sv = .() { mX = 3, mY = 4};
StructW sw = .() { mX = 3 };
StructX sx = .() { mA = 3, mB = 4, mC = "ABCD" };
void StartTest(String str)
{
@ -510,6 +521,11 @@ namespace Tests
Test.Assert(si0.MethodI1(si1, 12).mA == (int8)193);
Test.Assert(Func2I(si0, 12).mA == 102);
/*var sx1 = Func2X(sx, 100);
Test.Assert(sx1.mA == 103);
Test.Assert(sx1.mB == 4);
Test.Assert(sx1.mC == (char8*)"BCD"+1);*/
StructJ sj0;
sj0.mPtr = "ABC";
sj0.mLength = 3;