forked from kellerkindt/asn1rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
protobuf_set.rs
44 lines (37 loc) · 917 Bytes
/
protobuf_set.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
mod test_utils;
use test_utils::*;
asn_to_rust!(
r"MyDef DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
ProtobufSet ::= SET {
inner SET { magic-number INTEGER }
}
ProtobufSetExt ::= SET {
lone-bool BOOLEAN,
inner SET { magic-number INTEGER },
another-string UTF8String
}
END"
);
#[test]
#[cfg(feature = "protobuf")]
fn test_set() {
serialize_and_deserialize_protobuf(
&[10, 2, 8, 42],
&ProtobufSet {
inner: ProtobufSetInner { magic_number: 42 },
},
)
}
#[test]
#[cfg(feature = "protobuf")]
fn test_set_ext() {
serialize_and_deserialize_protobuf(
&[8, 0, 18, 3, 8, 185, 10, 26, 3, 101, 120, 116],
&ProtobufSetExt {
lone_bool: false,
inner: ProtobufSetExtInner { magic_number: 1337 },
another_string: "ext".into(),
},
)
}