mirror of
https://github.com/inzerosight/ZWUS-rs.git
synced 2026-04-07 05:02:15 +00:00
Feat: add npm golden vector decode test
Co-authored-by: gpt-5.3-codex <no-reply@openai.com>
This commit is contained in:
@@ -26,3 +26,35 @@ fn decode_ignores_non_zwus_characters() {
|
|||||||
let mixed = format!("te{hidden}xt");
|
let mixed = format!("te{hidden}xt");
|
||||||
assert_eq!(Zwus::decode_to_string_with_base(&mixed, 6), "secret");
|
assert_eq!(Zwus::decode_to_string_with_base(&mixed, 6), "secret");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn npm_vectors_decode_to_test123_checkmark() {
|
||||||
|
// Paste encoded outputs from your npm package here:
|
||||||
|
// zwus.encodeString("Test123!✅", 3)
|
||||||
|
// zwus.encodeString("Test123!✅", 6)
|
||||||
|
// zwus.encodeString("Test123!✅", 8)
|
||||||
|
//
|
||||||
|
// Keep these as raw strings to preserve invisible chars exactly.
|
||||||
|
let npm_base_3 = r#""#;
|
||||||
|
let npm_base_6 = r#""#;
|
||||||
|
let npm_base_8 = r#""#;
|
||||||
|
|
||||||
|
let expected = "Test123!✅";
|
||||||
|
|
||||||
|
assert!(
|
||||||
|
!npm_base_3.is_empty(),
|
||||||
|
"Paste base-3 encoded payload into npm_base_3"
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
!npm_base_6.is_empty(),
|
||||||
|
"Paste base-6 encoded payload into npm_base_6"
|
||||||
|
);
|
||||||
|
assert!(
|
||||||
|
!npm_base_8.is_empty(),
|
||||||
|
"Paste base-8 encoded payload into npm_base_8"
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!(Zwus::decode_to_string_with_base(npm_base_3, 3), expected);
|
||||||
|
assert_eq!(Zwus::decode_to_string_with_base(npm_base_6, 6), expected);
|
||||||
|
assert_eq!(Zwus::decode_to_string_with_base(npm_base_8, 8), expected);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user