Skip to content

Commit

Permalink
Add roundtrip test for enum
Browse files Browse the repository at this point in the history
  • Loading branch information
fwcd committed Aug 2, 2023
1 parent a155fc5 commit 813f5ad
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/roundtrip_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,31 @@ fn derived_structs() {
assert_roundtrips!(Unit);
}

#[test]
fn derived_enums() {
#[derive(Size, Pack, Unpack, Clone, Copy, PartialEq, Eq, Debug)]
#[repr(u8)]
#[allow(dead_code)]
enum X {
A = 1,
B = 4,
C = 8,
}

#[derive(Size, Pack, Unpack, Clone, Copy, PartialEq, Eq, Debug)]
#[repr(i32)]
#[allow(dead_code)]
enum Y {
A = -9,
B = 32,
C = 1,
}

assert_roundtrips!(X::A);
assert_roundtrips!(X::B);
assert_roundtrips!(X::C);
assert_roundtrips!(Y::A);
assert_roundtrips!(Y::B);
assert_roundtrips!(Y::C);
}

0 comments on commit 813f5ad

Please sign in to comment.