mirror of
https://codeberg.org/icewind/bitbuffer.git
synced 2026-06-03 16:44:06 +02:00
Check endianess when unconditionally reading boolean values
This commit is contained in:
parent
4a3d5820f8
commit
1e575b8efc
2 changed files with 16 additions and 2 deletions
|
|
@ -82,6 +82,13 @@ fn test_bare_enum() {
|
|||
|
||||
#[test]
|
||||
fn test_field_enum() {
|
||||
#[derive(Debug, PartialEq, BitRead, BitWrite)]
|
||||
struct CompoundVariant(
|
||||
#[size = 15]
|
||||
u16,
|
||||
bool,
|
||||
);
|
||||
|
||||
#[derive(Debug, PartialEq, BitRead, BitWrite)]
|
||||
#[discriminant_bits = 4]
|
||||
enum Enum {
|
||||
|
|
@ -89,11 +96,13 @@ fn test_field_enum() {
|
|||
B(String),
|
||||
C(f32),
|
||||
D(#[size = 15] i64),
|
||||
E(CompoundVariant),
|
||||
}
|
||||
roundtrip(Enum::A);
|
||||
roundtrip(Enum::B("foobar".into()));
|
||||
roundtrip(Enum::C(12.0));
|
||||
roundtrip(Enum::D(-12345));
|
||||
roundtrip(Enum::E(CompoundVariant(6789, true)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue