1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Fixed enum tests

This commit is contained in:
Brian Fiete 2025-03-17 13:05:38 -04:00
parent 8e8a28b23e
commit 295a46237a

View file

@ -123,7 +123,8 @@ namespace Tests
{ {
A, A,
B, B,
C C,
D = 4
} }
[Test] [Test]
@ -292,11 +293,19 @@ namespace Tests
Test.Assert(sizeof(EnumN) == sizeof(System.Interop.c_int)); Test.Assert(sizeof(EnumN) == sizeof(System.Interop.c_int));
Test.Assert(value.HasFlag(.A) == false); Test.Assert(value.HasFlag(.A) == true);
Test.Assert(value.HasFlag(.B) == true); Test.Assert(value.HasFlag(.B) == true);
Test.Assert(value.HasFlag(.B | .C) == false);
Test.Assert(value.HasFlag(.D) == false);
Test.Assert(value.Underlying == 1); Test.Assert(value.Underlying == 1);
value = .B | .C;
Test.Assert(value.HasFlag(.A) == true);
Test.Assert(value.HasFlag(.B) == true);
Test.Assert(value.HasFlag(.B | .C) == true);
Test.Assert(value.HasFlag(.D) == false);
Test.Assert(value.Underlying == 3);
ref System.Interop.c_int valueRef = ref value.UnderlyingRef; ref System.Interop.c_int valueRef = ref value.UnderlyingRef;
valueRef = 2; valueRef = 2;
Test.Assert(value == .C); Test.Assert(value == .C);