Skip to content

Commit

Permalink
graphic string tests
Browse files Browse the repository at this point in the history
  • Loading branch information
privatepatrick committed Feb 4, 2025
1 parent 495014f commit 4e1926b
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 5 deletions.
55 changes: 51 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rasn-compiler-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ readme.workspace = true
[dependencies]
rasn-compiler-derive = { path = "../rasn-compiler-derive" }
rasn-compiler = { path = "../rasn-compiler" }
rasn = { version = "0.22.0" }
rasn = { version = "0.24.0" }

[dev-dependencies]
bitvec = { version = "1" }
Expand Down
70 changes: 70 additions & 0 deletions rasn-compiler-tests/tests/simple_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,76 @@ e2e_pdu!(
} "#
);

e2e_pdu!(
graphic,
r#" Test-String ::= GraphicString
test-string-val Test-String ::= "012345""#,
r#" #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
#[rasn(delegate, identifier = "Test-String")]
pub struct TestString(pub GraphicString);
lazy_static!{
pub static ref TEST_STRING_VAL: TestString = TestString(
GraphicString::try_from(String::from("012345")).unwrap()
);
} "#
);

e2e_pdu!(
graphic_strict,
r#" Test-String ::= GraphicString SIZE (4)
test-string-val Test-String ::= "012345""#,
r#" #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
#[rasn(delegate, size("4"), identifier = "Test-String")]
pub struct TestString(pub GraphicString);
lazy_static!{
pub static ref TEST_STRING_VAL: TestString = TestString(
GraphicString::try_from(String::from("012345")).unwrap()
);
} "#
);

e2e_pdu!(
graphic_strict_ext,
r#" Test-String ::= GraphicString SIZE (4,...)
test-string-val Test-String ::= "012345""#,
r#" #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
#[rasn(delegate, size("4", extensible), identifier = "Test-String")]
pub struct TestString(pub GraphicString);
lazy_static!{
pub static ref TEST_STRING_VAL: TestString = TestString(
GraphicString::try_from(String::from("012345")).unwrap()
);
} "#
);

e2e_pdu!(
graphic_range,
r#" Test-String ::= GraphicString SIZE (4..6)
test-string-val Test-String ::= "012345""#,
r#" #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
#[rasn(delegate, size("4..=6"), identifier = "Test-String")]
pub struct TestString(pub GraphicString);
lazy_static!{
pub static ref TEST_STRING_VAL: TestString = TestString(
GraphicString::try_from(String::from("012345")).unwrap()
);
} "#
);

e2e_pdu!(
graphic_range_ext,
r#" Test-String ::= GraphicString SIZE (4..6,...)
test-string-val Test-String ::= "012345""#,
r#" #[derive(AsnType, Debug, Clone, Decode, Encode, PartialEq, Eq, Hash)]
#[rasn(delegate, size("4..=6", extensible), identifier = "Test-String")]
pub struct TestString(pub GraphicString);
lazy_static!{
pub static ref TEST_STRING_VAL: TestString = TestString(
GraphicString::try_from(String::from("012345")).unwrap()
);
} "#
);

e2e_pdu!(
utf8,
r#" Test-String ::= UTF8String
Expand Down

0 comments on commit 4e1926b

Please sign in to comment.