mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-20 08:58:00 +02:00
Fixed static bitfields
This commit is contained in:
parent
df604e6657
commit
3c74588e10
2 changed files with 12 additions and 9 deletions
|
@ -22,29 +22,29 @@ namespace Tests
|
|||
[Bitfield<uint8>(.Public, .BitsRev(8), "F")]
|
||||
[Bitfield<uint8>(.Public, .ValueRangeRev(0..<256), "G")]
|
||||
[Bitfield<uint8>(.Public, .BitsAt(8, 0), "H")]
|
||||
public int32 mVal2;
|
||||
public static int32 sVal2;
|
||||
}
|
||||
|
||||
[Test]
|
||||
static void TestBasics()
|
||||
{
|
||||
Test.Assert(sizeof(StructA) == 8);
|
||||
Test.Assert(sizeof(StructA) == 4);
|
||||
StructA sa = .();
|
||||
sa.A = 0x12;
|
||||
sa.B = 7;
|
||||
sa.C = .C;
|
||||
sa.D = 9;
|
||||
sa.E = 0x22;
|
||||
sa.F = 0x33;
|
||||
sa.G = 0x44;
|
||||
sa.H = 0x55;
|
||||
StructA.E = 0x22;
|
||||
StructA.F = 0x33;
|
||||
StructA.G = 0x44;
|
||||
StructA.H = 0x55;
|
||||
Test.Assert(sa.A == 0x12);
|
||||
Test.Assert(sa.B == 7);
|
||||
Test.Assert(sa.C == .C);
|
||||
Test.Assert(sa.D == 9);
|
||||
|
||||
Test.Assert(sa.mVal == 0x0025FF12);
|
||||
Test.Assert(sa.mVal2 == 0x22334455);
|
||||
Test.Assert(StructA.sVal2 == 0x22334455);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue