mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +02:00
Fixed generated methods for enums with CRepr
This commit is contained in:
parent
27620fa35d
commit
8095ddaa66
2 changed files with 42 additions and 4 deletions
|
@ -118,6 +118,14 @@ namespace Tests
|
|||
case C;
|
||||
}
|
||||
|
||||
[CRepr]
|
||||
public enum EnumN
|
||||
{
|
||||
A,
|
||||
B,
|
||||
C
|
||||
}
|
||||
|
||||
[Test]
|
||||
static void TestBasic()
|
||||
{
|
||||
|
@ -276,5 +284,24 @@ namespace Tests
|
|||
EnumL el = .A;
|
||||
Test.Assert(el == 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
static void TestCrepr()
|
||||
{
|
||||
EnumN value = .B;
|
||||
|
||||
Test.Assert(sizeof(EnumN) == sizeof(System.Interop.c_int));
|
||||
|
||||
Test.Assert(value.Underlying == 1);
|
||||
|
||||
ref System.Interop.c_int valueRef = ref value.UnderlyingRef;
|
||||
valueRef = 2;
|
||||
Test.Assert(value == .C);
|
||||
|
||||
String str = scope String();
|
||||
value.ToString(str);
|
||||
|
||||
Test.Assert(str == "C");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue