Playground enhancements

This commit is contained in:
2025-07-15 19:58:58 -04:00
parent 3289c95e6a
commit bb2ae861b3
73 changed files with 834 additions and 451 deletions

View File

@@ -0,0 +1,14 @@
import test from "node:test";
import assert from "node:assert";
import { b64decode, b64encode } from "./base64.ts";
test("round trip", () => {
for (let s of ["", "a", "aa", "aaa", "aaaa", "aaaaa", "aaaaaa"]) {
let t = new TextEncoder().encode(s);
console.log(t, t + "");
let enc = b64encode(t);
assert.equal(enc.length, Math.ceil((t.length * 8) / 6));
assert.equal(b64decode(b64encode(t)) + "", t + "");
console.log("---");
}
});