Skip to content

Commit

Permalink
Add explicit discriminant test
Browse files Browse the repository at this point in the history
  • Loading branch information
Rigidity committed Nov 29, 2023
1 parent ebfdcd1 commit d976a90
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions clvm-traits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,22 @@ mod tests {
check(Enum::C, "ff0280");
}

#[test]
fn test_explicit_enum() {
#[derive(Debug, ToClvm, FromClvm, PartialEq, Eq)]
#[clvm(tuple)]
#[repr(u8)]
enum Enum {
A(i32) = 42,
B { x: i32 } = 34,
C = 11,
}

check(Enum::A(32), "ff2a20");
check(Enum::B { x: -72 }, "ff2281b8");
check(Enum::C, "ff0b80");
}

#[test]
fn test_untagged_enum() {
#[derive(Debug, ToClvm, FromClvm, PartialEq, Eq)]
Expand Down

0 comments on commit d976a90

Please sign in to comment.