base32: update base32 api

Update the base32 api to be consistent with the recent changes to the
base64 api introduced by commit 60101830 ("Updated base64 encoding
api").
This commit is contained in:
Koni Marti
2024-11-24 19:38:50 +01:00
committed by Christoffer Lerno
parent b0c0fd7dc8
commit 8d03aafe72
2 changed files with 55 additions and 0 deletions

View File

@@ -98,3 +98,18 @@ fn void decode_nopadding()
decode_tests(std_tests, base32::STD_ALPHABET, -1);
decode_tests(hex_tests, base32::HEX_ALPHABET, -1);
}
fn void! base32_api()
{
@pool()
{
foreach (t : std_tests)
{
String got = base32::encode_temp(t.dec)!;
assert(got == t.enc, "got: %s, want: %s", got, t.enc);
char[] got_chars = base32::decode_temp(t.enc)!;
assert(got_chars == t.dec, "got: %s, want: %s", got_chars, t.dec);
}
};
}