mirror of
https://codeberg.org/icewind/bitbuffer.git
synced 2026-06-03 08:34:07 +02:00
enum roundtrip
This commit is contained in:
parent
55386818eb
commit
f5e329ab61
1 changed files with 16 additions and 0 deletions
|
|
@ -74,3 +74,19 @@ fn test_bare_enum() {
|
|||
roundtrip(Enum::C);
|
||||
roundtrip(Enum::D);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_field_enum() {
|
||||
#[derive(Debug, PartialEq, BitRead, BitWrite)]
|
||||
#[discriminant_bits = 4]
|
||||
enum Enum {
|
||||
A,
|
||||
B(String),
|
||||
C(f32),
|
||||
D(#[size = 15] i64),
|
||||
}
|
||||
roundtrip(Enum::A);
|
||||
roundtrip(Enum::B("foobar".into()));
|
||||
roundtrip(Enum::C(12.0));
|
||||
roundtrip(Enum::D(-12345));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue