Skip to content

Commit

Permalink
Add regression test that an enum is correctly deserialized for an abs…
Browse files Browse the repository at this point in the history
…ent tag
  • Loading branch information
kellerkindt committed Sep 13, 2021
1 parent 681ff2b commit 4568b1f
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions tests/protobuf_enumerated_missing.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
mod test_utils;

use test_utils::*;

asn_to_rust!(
r"MyDef DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
ComplexType ::= SEQUENCE {
enum-one ENUMERATED {
A,
B,
C
},
enum-two ENUMERATEd {
AA,
BB,
CC
}
}
END"
);

#[test]
#[cfg(feature = "protobuf")]
fn test_missing_enum_one() {
assert_eq!(
ComplexType {
enum_one: ComplexTypeEnumOne::B,
enum_two: ComplexTypeEnumTwo::Aa,
},
deserialize_protobuf(&[8, 1],)
);
}

#[test]
#[cfg(feature = "protobuf")]
fn test_missing_enum_two() {
assert_eq!(
ComplexType {
enum_one: ComplexTypeEnumOne::A,
enum_two: ComplexTypeEnumTwo::Bb,
},
deserialize_protobuf(&[16, 1],)
);
}

0 comments on commit 4568b1f

Please sign in to comment.