Skip to content

Commit

Permalink
Add tests for fragmented OCTET STRINGs
Browse files Browse the repository at this point in the history
  • Loading branch information
kellerkindt committed Dec 7, 2021
1 parent 5061379 commit ee74d2b
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tests/uper_octet_string.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
mod test_utils;

use test_utils::*;

asn_to_rust!(
r#"TransparentConsts DEFINITIONS AUTOMATIC TAGS ::=
BEGIN
Container ::= SEQUENCE {
value OCTET STRING
}
END"#
);

#[test]
pub fn octet_string_fragmented_16383() {
octet_string_fragmented(
16383,
8 * 16385,
include_bytes!("uper_octet_string_fragmented_16383.uper"),
);
}

#[test]
pub fn octet_string_fragmented_16384() {
octet_string_fragmented(
16384,
8 * 16386,
include_bytes!("uper_octet_string_fragmented_16384.uper"),
);
}

#[test]
pub fn octet_string_fragmented_65536() {
octet_string_fragmented(
65536,
8 * 65538,
include_bytes!("uper_octet_string_fragmented_65536.uper"),
);
}

pub fn octet_string_fragmented(value_len: usize, bits: usize, bytes: &[u8]) {
let container = Container {
value: vec![0u8; value_len],
};
serialize_and_deserialize_uper(bits, bytes, &container);
}
Binary file added tests/uper_octet_string_fragmented_16383.uper
Binary file not shown.
Binary file added tests/uper_octet_string_fragmented_16384.uper
Binary file not shown.
Binary file added tests/uper_octet_string_fragmented_65536.uper
Binary file not shown.

0 comments on commit ee74d2b

Please sign in to comment.