From 34fb0776416753abb145f72904dad104eba3b8d8 Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Fri, 27 Mar 2026 01:07:27 -0700 Subject: [PATCH] Feat: add npm golden vector decode test Co-authored-by: gpt-5.3-codex --- tests/zwus.rs | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/tests/zwus.rs b/tests/zwus.rs index 618cb35..02047a4 100644 --- a/tests/zwus.rs +++ b/tests/zwus.rs @@ -26,3 +26,35 @@ fn decode_ignores_non_zwus_characters() { let mixed = format!("te{hidden}xt"); 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); +}