Updated base64 encoding api.

This commit is contained in:
Christoffer Lerno
2024-11-24 00:14:31 +01:00
parent a58d782704
commit 60101830cc
2 changed files with 91 additions and 7 deletions

View File

@@ -23,12 +23,16 @@ fn void encode()
};
foreach (tc : tcases)
{
Base64Encoder b;
b.init(base64::STD_ALPHABET)!;
usz n = b.encode_len(tc.in.len);
char[64] buf;
b.encode(tc.in, buf[:n])!;
assert(buf[:n] == tc.out);
@pool()
{
Base64Encoder b;
b.init(base64::STD_ALPHABET)!;
usz n = b.encode_len(tc.in.len);
char[64] buf;
b.encode(tc.in, buf[:n])!;
assert(buf[:n] == tc.out);
assert(base64::encode_temp(tc.in) == tc.out);
};
}
}