diff --git a/bindings/typescript/.gitignore b/bindings/typescript/.gitignore
index 1521c8b..4951415 100644
--- a/bindings/typescript/.gitignore
+++ b/bindings/typescript/.gitignore
@@ -1 +1,6 @@
dist
+jex_mindist
+jex_include
+*.beam
+*.swp
+*.swo
diff --git a/bindings/typescript/src/base64.ts b/bindings/typescript/src/base64.ts
index 30ee768..b90a07b 100644
--- a/bindings/typescript/src/base64.ts
+++ b/bindings/typescript/src/base64.ts
@@ -94,30 +94,30 @@ encode3(bytes: Uint8Array) {
let b1 : number = bytes[1];
let b2 : number = bytes[2];
- // ABCDEFGH 12345678 ABCDEFGH
+ // ABCDEFGH 12345678 abcdefgh
// b0 b1 b2
- // ABCDEF GH1234 5678AB CDEFGH
+ // ABCDEF GH1234 5678ab cdefgh
// n0 n1 n2 n3
let n0 : number = b0 >> 2;
- // n1 = __GH1234
// b0 = ABCDEFGH
// 4 = _____1__
// b0 % 4 = ______GH
// (b0 % 4) << 4 = __GH____
// b1 = 12345678
// b1 >> 4 = ____1234
+ // n1 = __GH1234
let n1 : number = ((b0 % 4) << 4) + (b1 >> 4);
- // n2 = __5678AB
// b1 = 12345678
// 16 = ___1____
// b1 % 16 = ____5678
// (b1 % 16) << 2 = __5678__
- // b1 = ABCDEFGH
- // b1 >> 6 = ______AB
- let n2 : number = ((b1 % 16) << 2) + (b1 >> 6);
- // n3 = 00CDEFGH
- // 64 = 01000000
- // b2 = ABCDEFGH
+ // b2 = abcdefgh
+ // b2 >> 6 = ______ab
+ // n2 = __5678ab
+ let n2 : number = ((b1 % 16) << 2) + (b2 >> 6);
+ // b2 = abcdefgh
+ // 64 = _1______
+ // n3 = __cdefgh
let n3 : number = b2 % 64;
// convert to chars
@@ -183,7 +183,6 @@ encode1(bytes: Uint8Array): string {
*/
function
encode2(bytes: Uint8Array): string {
- return int2char(n0) + int2char(n1) + '==';
let b0 : number = bytes[0];
let b1 : number = bytes[1];
@@ -192,19 +191,19 @@ encode2(bytes: Uint8Array): string {
// ABCDEF GH1234 5678__
// n0 n1 n2
let n0 : number = b0 >> 2;
- // n1 = __GH1234
// b0 = ABCDEFGH
// 4 = _____1__
// b0 % 4 = ______GH
// (b0 % 4) << 4 = __GH____
// b1 = 12345678
// b1 >> 4 = ____1234
+ // n1 = __GH1234
let n1 : number = ((b0 % 4) << 4) + (b1 >> 4);
- // n2 = __5678AB
// b1 = 12345678
// 16 = ___1____
// b1 % 16 = ____5678
// (b1 % 16) << 2 = __5678__
+ // n2 = __5678__
let n2 : number = (b1 % 16) << 2;
// convert to chars
diff --git a/bindings/typescript/test/favicon.ico b/bindings/typescript/test/favicon.ico
new file mode 100644
index 0000000..8d9ff50
Binary files /dev/null and b/bindings/typescript/test/favicon.ico differ
diff --git a/bindings/typescript/test/index.html b/bindings/typescript/test/index.html
new file mode 100644
index 0000000..dc67c48
--- /dev/null
+++ b/bindings/typescript/test/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+ Vanillae Tests
+
+
+
+Base64 Encode Tests
+
+
+
+
+
diff --git a/bindings/typescript/test/jex.eterms b/bindings/typescript/test/jex.eterms
new file mode 100644
index 0000000..83b4b31
--- /dev/null
+++ b/bindings/typescript/test/jex.eterms
@@ -0,0 +1,5 @@
+{type, library}.
+{realm, local}.
+{name, vanillae_test}.
+{version, "0.1.0"}.
+{deps, ["local-vanillae-0.1.0"]}.
diff --git a/bindings/typescript/test/src/test.ts b/bindings/typescript/test/src/test.ts
new file mode 100644
index 0000000..ea8bdb2
--- /dev/null
+++ b/bindings/typescript/test/src/test.ts
@@ -0,0 +1,547 @@
+import * as b64 from './jex_include/local-vanillae-0.1.0/dist/base64.js';
+
+function
+main(): void {
+ // @ts-ignore ts can't prove to itself that the element exists
+ let b64_pre : HTMLElement = document.getElementById('base64-encode-assershins');
+
+ for(let this_case of cases()) {
+ let {encoded, decoded} = this_case;
+ let my_b64_encoded = b64.encode(decoded);
+ b64_pre.innerHTML += 'decoded : ' + decoded + '\n';
+ b64_pre.innerHTML += 'expected: ' + encoded + '\n';
+ b64_pre.innerHTML += 'actual : ' + my_b64_encoded + '\n';
+ b64_pre.innerHTML += 'equal? : ' + (encoded === my_b64_encoded) + '\n\n';
+ }
+}
+main();
+
+function cases() {
+ return [
+ {decoded: new Uint8Array([121, 146, 210]),
+ encoded: "eZLS"},
+ {decoded: new Uint8Array([]),
+ encoded: ""},
+ {decoded: new Uint8Array([255]),
+ encoded: "/w=="},
+ {decoded: new Uint8Array([254]),
+ encoded: "/g=="},
+ {decoded: new Uint8Array([253]),
+ encoded: "/Q=="},
+ {decoded: new Uint8Array([252]),
+ encoded: "/A=="},
+ {decoded: new Uint8Array([251]),
+ encoded: "+w=="},
+ {decoded: new Uint8Array([250]),
+ encoded: "+g=="},
+ {decoded: new Uint8Array([249]),
+ encoded: "+Q=="},
+ {decoded: new Uint8Array([248]),
+ encoded: "+A=="},
+ {decoded: new Uint8Array([247]),
+ encoded: "9w=="},
+ {decoded: new Uint8Array([246]),
+ encoded: "9g=="},
+ {decoded: new Uint8Array([245]),
+ encoded: "9Q=="},
+ {decoded: new Uint8Array([244]),
+ encoded: "9A=="},
+ {decoded: new Uint8Array([243]),
+ encoded: "8w=="},
+ {decoded: new Uint8Array([242]),
+ encoded: "8g=="},
+ {decoded: new Uint8Array([241]),
+ encoded: "8Q=="},
+ {decoded: new Uint8Array([240]),
+ encoded: "8A=="},
+ {decoded: new Uint8Array([239]),
+ encoded: "7w=="},
+ {decoded: new Uint8Array([238]),
+ encoded: "7g=="},
+ {decoded: new Uint8Array([237]),
+ encoded: "7Q=="},
+ {decoded: new Uint8Array([236]),
+ encoded: "7A=="},
+ {decoded: new Uint8Array([235]),
+ encoded: "6w=="},
+ {decoded: new Uint8Array([234]),
+ encoded: "6g=="},
+ {decoded: new Uint8Array([233]),
+ encoded: "6Q=="},
+ {decoded: new Uint8Array([232]),
+ encoded: "6A=="},
+ {decoded: new Uint8Array([231]),
+ encoded: "5w=="},
+ {decoded: new Uint8Array([230]),
+ encoded: "5g=="},
+ {decoded: new Uint8Array([229]),
+ encoded: "5Q=="},
+ {decoded: new Uint8Array([228]),
+ encoded: "5A=="},
+ {decoded: new Uint8Array([227]),
+ encoded: "4w=="},
+ {decoded: new Uint8Array([226]),
+ encoded: "4g=="},
+ {decoded: new Uint8Array([225]),
+ encoded: "4Q=="},
+ {decoded: new Uint8Array([224]),
+ encoded: "4A=="},
+ {decoded: new Uint8Array([223]),
+ encoded: "3w=="},
+ {decoded: new Uint8Array([222]),
+ encoded: "3g=="},
+ {decoded: new Uint8Array([221]),
+ encoded: "3Q=="},
+ {decoded: new Uint8Array([220]),
+ encoded: "3A=="},
+ {decoded: new Uint8Array([219]),
+ encoded: "2w=="},
+ {decoded: new Uint8Array([218]),
+ encoded: "2g=="},
+ {decoded: new Uint8Array([217]),
+ encoded: "2Q=="},
+ {decoded: new Uint8Array([216]),
+ encoded: "2A=="},
+ {decoded: new Uint8Array([215]),
+ encoded: "1w=="},
+ {decoded: new Uint8Array([214]),
+ encoded: "1g=="},
+ {decoded: new Uint8Array([213]),
+ encoded: "1Q=="},
+ {decoded: new Uint8Array([212]),
+ encoded: "1A=="},
+ {decoded: new Uint8Array([211]),
+ encoded: "0w=="},
+ {decoded: new Uint8Array([210]),
+ encoded: "0g=="},
+ {decoded: new Uint8Array([209]),
+ encoded: "0Q=="},
+ {decoded: new Uint8Array([208]),
+ encoded: "0A=="},
+ {decoded: new Uint8Array([207]),
+ encoded: "zw=="},
+ {decoded: new Uint8Array([206]),
+ encoded: "zg=="},
+ {decoded: new Uint8Array([205]),
+ encoded: "zQ=="},
+ {decoded: new Uint8Array([204]),
+ encoded: "zA=="},
+ {decoded: new Uint8Array([203]),
+ encoded: "yw=="},
+ {decoded: new Uint8Array([202]),
+ encoded: "yg=="},
+ {decoded: new Uint8Array([201]),
+ encoded: "yQ=="},
+ {decoded: new Uint8Array([200]),
+ encoded: "yA=="},
+ {decoded: new Uint8Array([199]),
+ encoded: "xw=="},
+ {decoded: new Uint8Array([198]),
+ encoded: "xg=="},
+ {decoded: new Uint8Array([197]),
+ encoded: "xQ=="},
+ {decoded: new Uint8Array([196]),
+ encoded: "xA=="},
+ {decoded: new Uint8Array([195]),
+ encoded: "ww=="},
+ {decoded: new Uint8Array([194]),
+ encoded: "wg=="},
+ {decoded: new Uint8Array([193]),
+ encoded: "wQ=="},
+ {decoded: new Uint8Array([192]),
+ encoded: "wA=="},
+ {decoded: new Uint8Array([191]),
+ encoded: "vw=="},
+ {decoded: new Uint8Array([190]),
+ encoded: "vg=="},
+ {decoded: new Uint8Array([189]),
+ encoded: "vQ=="},
+ {decoded: new Uint8Array([188]),
+ encoded: "vA=="},
+ {decoded: new Uint8Array([187]),
+ encoded: "uw=="},
+ {decoded: new Uint8Array([186]),
+ encoded: "ug=="},
+ {decoded: new Uint8Array([185]),
+ encoded: "uQ=="},
+ {decoded: new Uint8Array([184]),
+ encoded: "uA=="},
+ {decoded: new Uint8Array([183]),
+ encoded: "tw=="},
+ {decoded: new Uint8Array([182]),
+ encoded: "tg=="},
+ {decoded: new Uint8Array([181]),
+ encoded: "tQ=="},
+ {decoded: new Uint8Array([180]),
+ encoded: "tA=="},
+ {decoded: new Uint8Array([179]),
+ encoded: "sw=="},
+ {decoded: new Uint8Array([178]),
+ encoded: "sg=="},
+ {decoded: new Uint8Array([177]),
+ encoded: "sQ=="},
+ {decoded: new Uint8Array([176]),
+ encoded: "sA=="},
+ {decoded: new Uint8Array([175]),
+ encoded: "rw=="},
+ {decoded: new Uint8Array([174]),
+ encoded: "rg=="},
+ {decoded: new Uint8Array([173]),
+ encoded: "rQ=="},
+ {decoded: new Uint8Array([172]),
+ encoded: "rA=="},
+ {decoded: new Uint8Array([171]),
+ encoded: "qw=="},
+ {decoded: new Uint8Array([170]),
+ encoded: "qg=="},
+ {decoded: new Uint8Array([169]),
+ encoded: "qQ=="},
+ {decoded: new Uint8Array([168]),
+ encoded: "qA=="},
+ {decoded: new Uint8Array([167]),
+ encoded: "pw=="},
+ {decoded: new Uint8Array([166]),
+ encoded: "pg=="},
+ {decoded: new Uint8Array([165]),
+ encoded: "pQ=="},
+ {decoded: new Uint8Array([164]),
+ encoded: "pA=="},
+ {decoded: new Uint8Array([163]),
+ encoded: "ow=="},
+ {decoded: new Uint8Array([162]),
+ encoded: "og=="},
+ {decoded: new Uint8Array([161]),
+ encoded: "oQ=="},
+ {decoded: new Uint8Array([160]),
+ encoded: "oA=="},
+ {decoded: new Uint8Array([159]),
+ encoded: "nw=="},
+ {decoded: new Uint8Array([158]),
+ encoded: "ng=="},
+ {decoded: new Uint8Array([157]),
+ encoded: "nQ=="},
+ {decoded: new Uint8Array([156]),
+ encoded: "nA=="},
+ {decoded: new Uint8Array([155]),
+ encoded: "mw=="},
+ {decoded: new Uint8Array([154]),
+ encoded: "mg=="},
+ {decoded: new Uint8Array([153]),
+ encoded: "mQ=="},
+ {decoded: new Uint8Array([152]),
+ encoded: "mA=="},
+ {decoded: new Uint8Array([151]),
+ encoded: "lw=="},
+ {decoded: new Uint8Array([150]),
+ encoded: "lg=="},
+ {decoded: new Uint8Array([149]),
+ encoded: "lQ=="},
+ {decoded: new Uint8Array([148]),
+ encoded: "lA=="},
+ {decoded: new Uint8Array([147]),
+ encoded: "kw=="},
+ {decoded: new Uint8Array([146]),
+ encoded: "kg=="},
+ {decoded: new Uint8Array([145]),
+ encoded: "kQ=="},
+ {decoded: new Uint8Array([144]),
+ encoded: "kA=="},
+ {decoded: new Uint8Array([143]),
+ encoded: "jw=="},
+ {decoded: new Uint8Array([142]),
+ encoded: "jg=="},
+ {decoded: new Uint8Array([141]),
+ encoded: "jQ=="},
+ {decoded: new Uint8Array([140]),
+ encoded: "jA=="},
+ {decoded: new Uint8Array([139]),
+ encoded: "iw=="},
+ {decoded: new Uint8Array([138]),
+ encoded: "ig=="},
+ {decoded: new Uint8Array([137]),
+ encoded: "iQ=="},
+ {decoded: new Uint8Array([136]),
+ encoded: "iA=="},
+ {decoded: new Uint8Array([135]),
+ encoded: "hw=="},
+ {decoded: new Uint8Array([134]),
+ encoded: "hg=="},
+ {decoded: new Uint8Array([133]),
+ encoded: "hQ=="},
+ {decoded: new Uint8Array([132]),
+ encoded: "hA=="},
+ {decoded: new Uint8Array([131]),
+ encoded: "gw=="},
+ {decoded: new Uint8Array([130]),
+ encoded: "gg=="},
+ {decoded: new Uint8Array([129]),
+ encoded: "gQ=="},
+ {decoded: new Uint8Array([128]),
+ encoded: "gA=="},
+ {decoded: new Uint8Array([127]),
+ encoded: "fw=="},
+ {decoded: new Uint8Array([126]),
+ encoded: "fg=="},
+ {decoded: new Uint8Array([125]),
+ encoded: "fQ=="},
+ {decoded: new Uint8Array([124]),
+ encoded: "fA=="},
+ {decoded: new Uint8Array([123]),
+ encoded: "ew=="},
+ {decoded: new Uint8Array([122]),
+ encoded: "eg=="},
+ {decoded: new Uint8Array([121]),
+ encoded: "eQ=="},
+ {decoded: new Uint8Array([120]),
+ encoded: "eA=="},
+ {decoded: new Uint8Array([119]),
+ encoded: "dw=="},
+ {decoded: new Uint8Array([118]),
+ encoded: "dg=="},
+ {decoded: new Uint8Array([117]),
+ encoded: "dQ=="},
+ {decoded: new Uint8Array([116]),
+ encoded: "dA=="},
+ {decoded: new Uint8Array([115]),
+ encoded: "cw=="},
+ {decoded: new Uint8Array([114]),
+ encoded: "cg=="},
+ {decoded: new Uint8Array([113]),
+ encoded: "cQ=="},
+ {decoded: new Uint8Array([112]),
+ encoded: "cA=="},
+ {decoded: new Uint8Array([111]),
+ encoded: "bw=="},
+ {decoded: new Uint8Array([110]),
+ encoded: "bg=="},
+ {decoded: new Uint8Array([109]),
+ encoded: "bQ=="},
+ {decoded: new Uint8Array([108]),
+ encoded: "bA=="},
+ {decoded: new Uint8Array([107]),
+ encoded: "aw=="},
+ {decoded: new Uint8Array([106]),
+ encoded: "ag=="},
+ {decoded: new Uint8Array([105]),
+ encoded: "aQ=="},
+ {decoded: new Uint8Array([104]),
+ encoded: "aA=="},
+ {decoded: new Uint8Array([103]),
+ encoded: "Zw=="},
+ {decoded: new Uint8Array([102]),
+ encoded: "Zg=="},
+ {decoded: new Uint8Array([101]),
+ encoded: "ZQ=="},
+ {decoded: new Uint8Array([100]),
+ encoded: "ZA=="},
+ {decoded: new Uint8Array([99]),
+ encoded: "Yw=="},
+ {decoded: new Uint8Array([98]),
+ encoded: "Yg=="},
+ {decoded: new Uint8Array([97]),
+ encoded: "YQ=="},
+ {decoded: new Uint8Array([96]),
+ encoded: "YA=="},
+ {decoded: new Uint8Array([95]),
+ encoded: "Xw=="},
+ {decoded: new Uint8Array([94]),
+ encoded: "Xg=="},
+ {decoded: new Uint8Array([93]),
+ encoded: "XQ=="},
+ {decoded: new Uint8Array([92]),
+ encoded: "XA=="},
+ {decoded: new Uint8Array([91]),
+ encoded: "Ww=="},
+ {decoded: new Uint8Array([90]),
+ encoded: "Wg=="},
+ {decoded: new Uint8Array([89]),
+ encoded: "WQ=="},
+ {decoded: new Uint8Array([88]),
+ encoded: "WA=="},
+ {decoded: new Uint8Array([87]),
+ encoded: "Vw=="},
+ {decoded: new Uint8Array([86]),
+ encoded: "Vg=="},
+ {decoded: new Uint8Array([85]),
+ encoded: "VQ=="},
+ {decoded: new Uint8Array([84]),
+ encoded: "VA=="},
+ {decoded: new Uint8Array([83]),
+ encoded: "Uw=="},
+ {decoded: new Uint8Array([82]),
+ encoded: "Ug=="},
+ {decoded: new Uint8Array([81]),
+ encoded: "UQ=="},
+ {decoded: new Uint8Array([80]),
+ encoded: "UA=="},
+ {decoded: new Uint8Array([79]),
+ encoded: "Tw=="},
+ {decoded: new Uint8Array([78]),
+ encoded: "Tg=="},
+ {decoded: new Uint8Array([77]),
+ encoded: "TQ=="},
+ {decoded: new Uint8Array([76]),
+ encoded: "TA=="},
+ {decoded: new Uint8Array([75]),
+ encoded: "Sw=="},
+ {decoded: new Uint8Array([74]),
+ encoded: "Sg=="},
+ {decoded: new Uint8Array([73]),
+ encoded: "SQ=="},
+ {decoded: new Uint8Array([72]),
+ encoded: "SA=="},
+ {decoded: new Uint8Array([71]),
+ encoded: "Rw=="},
+ {decoded: new Uint8Array([70]),
+ encoded: "Rg=="},
+ {decoded: new Uint8Array([69]),
+ encoded: "RQ=="},
+ {decoded: new Uint8Array([68]),
+ encoded: "RA=="},
+ {decoded: new Uint8Array([67]),
+ encoded: "Qw=="},
+ {decoded: new Uint8Array([66]),
+ encoded: "Qg=="},
+ {decoded: new Uint8Array([65]),
+ encoded: "QQ=="},
+ {decoded: new Uint8Array([64]),
+ encoded: "QA=="},
+ {decoded: new Uint8Array([63]),
+ encoded: "Pw=="},
+ {decoded: new Uint8Array([62]),
+ encoded: "Pg=="},
+ {decoded: new Uint8Array([61]),
+ encoded: "PQ=="},
+ {decoded: new Uint8Array([60]),
+ encoded: "PA=="},
+ {decoded: new Uint8Array([59]),
+ encoded: "Ow=="},
+ {decoded: new Uint8Array([58]),
+ encoded: "Og=="},
+ {decoded: new Uint8Array([57]),
+ encoded: "OQ=="},
+ {decoded: new Uint8Array([56]),
+ encoded: "OA=="},
+ {decoded: new Uint8Array([55]),
+ encoded: "Nw=="},
+ {decoded: new Uint8Array([54]),
+ encoded: "Ng=="},
+ {decoded: new Uint8Array([53]),
+ encoded: "NQ=="},
+ {decoded: new Uint8Array([52]),
+ encoded: "NA=="},
+ {decoded: new Uint8Array([51]),
+ encoded: "Mw=="},
+ {decoded: new Uint8Array([50]),
+ encoded: "Mg=="},
+ {decoded: new Uint8Array([49]),
+ encoded: "MQ=="},
+ {decoded: new Uint8Array([48]),
+ encoded: "MA=="},
+ {decoded: new Uint8Array([47]),
+ encoded: "Lw=="},
+ {decoded: new Uint8Array([46]),
+ encoded: "Lg=="},
+ {decoded: new Uint8Array([45]),
+ encoded: "LQ=="},
+ {decoded: new Uint8Array([44]),
+ encoded: "LA=="},
+ {decoded: new Uint8Array([43]),
+ encoded: "Kw=="},
+ {decoded: new Uint8Array([42]),
+ encoded: "Kg=="},
+ {decoded: new Uint8Array([41]),
+ encoded: "KQ=="},
+ {decoded: new Uint8Array([40]),
+ encoded: "KA=="},
+ {decoded: new Uint8Array([39]),
+ encoded: "Jw=="},
+ {decoded: new Uint8Array([38]),
+ encoded: "Jg=="},
+ {decoded: new Uint8Array([37]),
+ encoded: "JQ=="},
+ {decoded: new Uint8Array([36]),
+ encoded: "JA=="},
+ {decoded: new Uint8Array([35]),
+ encoded: "Iw=="},
+ {decoded: new Uint8Array([34]),
+ encoded: "Ig=="},
+ {decoded: new Uint8Array([33]),
+ encoded: "IQ=="},
+ {decoded: new Uint8Array([32]),
+ encoded: "IA=="},
+ {decoded: new Uint8Array([31]),
+ encoded: "Hw=="},
+ {decoded: new Uint8Array([30]),
+ encoded: "Hg=="},
+ {decoded: new Uint8Array([29]),
+ encoded: "HQ=="},
+ {decoded: new Uint8Array([28]),
+ encoded: "HA=="},
+ {decoded: new Uint8Array([27]),
+ encoded: "Gw=="},
+ {decoded: new Uint8Array([26]),
+ encoded: "Gg=="},
+ {decoded: new Uint8Array([25]),
+ encoded: "GQ=="},
+ {decoded: new Uint8Array([24]),
+ encoded: "GA=="},
+ {decoded: new Uint8Array([23]),
+ encoded: "Fw=="},
+ {decoded: new Uint8Array([22]),
+ encoded: "Fg=="},
+ {decoded: new Uint8Array([21]),
+ encoded: "FQ=="},
+ {decoded: new Uint8Array([20]),
+ encoded: "FA=="},
+ {decoded: new Uint8Array([19]),
+ encoded: "Ew=="},
+ {decoded: new Uint8Array([18]),
+ encoded: "Eg=="},
+ {decoded: new Uint8Array([17]),
+ encoded: "EQ=="},
+ {decoded: new Uint8Array([16]),
+ encoded: "EA=="},
+ {decoded: new Uint8Array([15]),
+ encoded: "Dw=="},
+ {decoded: new Uint8Array([14]),
+ encoded: "Dg=="},
+ {decoded: new Uint8Array([13]),
+ encoded: "DQ=="},
+ {decoded: new Uint8Array([12]),
+ encoded: "DA=="},
+ {decoded: new Uint8Array([11]),
+ encoded: "Cw=="},
+ {decoded: new Uint8Array([10]),
+ encoded: "Cg=="},
+ {decoded: new Uint8Array([9]),
+ encoded: "CQ=="},
+ {decoded: new Uint8Array([8]),
+ encoded: "CA=="},
+ {decoded: new Uint8Array([7]),
+ encoded: "Bw=="},
+ {decoded: new Uint8Array([6]),
+ encoded: "Bg=="},
+ {decoded: new Uint8Array([5]),
+ encoded: "BQ=="},
+ {decoded: new Uint8Array([4]),
+ encoded: "BA=="},
+ {decoded: new Uint8Array([3]),
+ encoded: "Aw=="},
+ {decoded: new Uint8Array([2]),
+ encoded: "Ag=="},
+ {decoded: new Uint8Array([1]),
+ encoded: "AQ=="},
+ {decoded: new Uint8Array([0]),
+ encoded: "AA=="},
+ {decoded: new Uint8Array([92, 105, 50, 70, 202, 242, 245, 121, 74, 121, 146, 210, 166, 167, 44, 34, 243, 216, 18, 163, 190, 100, 72, 90, 221, 41, 209, 197, 83, 219, 98, 138, 138, 148, 140, 32, 239, 36, 236, 178, 150, 173, 194, 155, 159, 85, 6, 97, 110, 236, 74, 231, 193, 91, 207, 221, 109, 177, 15, 147, 197, 201, 107, 164, 229, 128, 170, 117, 205, 234, 204, 224, 55, 109, 36, 206, 63, 83, 253, 74, 45, 221, 213, 33, 236, 155, 154, 36, 0, 245, 74, 95, 47, 90, 3, 254, 122, 207, 74, 236, 172, 246, 127, 248, 152, 2, 162, 87, 212, 212, 104, 15, 34, 165, 106, 243, 103, 186, 239, 236, 186, 189, 73, 179, 245, 137, 107, 210, 90, 250, 140, 177, 100, 251, 153, 179, 242, 114, 21, 17, 42, 215, 238, 226, 167, 50, 115, 101, 145, 117, 26, 150, 44, 127, 48, 203, 217, 78, 107, 183, 186, 72, 132, 148, 56, 92, 45, 24, 220, 225, 47, 75, 167, 78, 178, 143, 172, 62, 2, 233, 200, 165, 200, 187, 52, 237, 69, 116, 57, 107, 30, 134, 137, 254, 215, 55, 164, 144, 130, 189, 182, 129, 228, 143, 11, 77, 248, 181, 113, 132, 20, 133, 210, 2, 240, 64, 44, 121, 116, 42, 99, 179, 180, 182, 192, 160, 176, 251, 117, 208, 20, 128, 101, 145, 254, 94, 65, 167, 51, 170, 198, 55, 223, 96, 131, 248, 179, 206, 243, 56, 214, 189, 133, 35, 56, 57, 8, 77, 203, 71, 142, 32, 246, 167, 181, 99, 173, 64, 110, 136, 89, 183, 230, 86, 50, 144, 24, 200, 152, 59, 110, 39, 51, 122, 69, 143, 173, 189, 50, 9, 102, 129, 169, 80, 135, 80, 102, 190, 163, 253, 165, 136, 186, 46, 163, 118, 228, 213, 63, 117, 0, 52, 146, 38, 96, 233, 82, 155, 245, 185, 32, 184, 155, 80, 70, 178, 77, 63, 13, 126, 77, 82, 77, 7, 96, 174, 157, 193, 209, 116, 239, 113, 79, 247, 232, 14, 106, 137, 80, 46, 250, 214, 31, 15, 220, 150, 11, 93, 13, 223, 29, 208, 169, 20, 11, 190, 44, 43, 70, 196, 232, 233, 181, 30, 85, 190, 157, 23, 104, 72, 50, 231, 209, 137, 211, 177, 189, 241, 147, 43, 115, 204, 184, 196, 144, 224, 215, 103, 240, 226, 127, 129, 197, 137, 7, 123, 150, 216, 100, 29, 75, 185, 90, 9, 56, 213, 179, 119, 51, 110, 59, 49, 253, 135, 55, 123, 116, 111, 10, 186, 105, 207, 109, 214, 111, 85, 33, 140, 111, 179, 109, 236, 74, 253, 138, 42, 90, 249, 192, 231, 110, 31, 211, 117, 132, 54, 148, 226, 85, 28, 164, 97, 176, 76, 187, 52, 83, 211, 230, 178, 209, 219, 108, 97, 231, 193, 246, 17, 38, 133, 141, 211, 231, 11, 95, 220, 250, 140, 78, 104, 72, 253, 250, 8, 40, 132, 70, 162, 90, 148, 9, 75, 129, 82, 249, 210, 19, 217, 156, 40, 52, 100, 77, 255, 9, 169, 127, 16, 178, 101, 10, 13, 183, 237, 147, 37, 86, 86]),
+ encoded: "XGkyRsry9XlKeZLSpqcsIvPYEqO+ZEha3SnRxVPbYoqKlIwg7yTsspatwpufVQZhbuxK58Fbz91tsQ+TxclrpOWAqnXN6szgN20kzj9T/Uot3dUh7JuaJAD1Sl8vWgP+es9K7Kz2f/iYAqJX1NRoDyKlavNnuu/sur1Js/WJa9Ja+oyxZPuZs/JyFREq1+7ipzJzZZF1GpYsfzDL2U5rt7pIhJQ4XC0Y3OEvS6dOso+sPgLpyKXIuzTtRXQ5ax6Gif7XN6SQgr22geSPC034tXGEFIXSAvBALHl0KmOztLbAoLD7ddAUgGWR/l5BpzOqxjffYIP4s87zONa9hSM4OQhNy0eOIPantWOtQG6IWbfmVjKQGMiYO24nM3pFj629MglmgalQh1BmvqP9pYi6LqN25NU/dQA0kiZg6VKb9bkguJtQRrJNPw1+TVJNB2CuncHRdO9xT/foDmqJUC761h8P3JYLXQ3fHdCpFAu+LCtGxOjptR5Vvp0XaEgy59GJ07G98ZMrc8y4xJDg12fw4n+BxYkHe5bYZB1LuVoJONWzdzNuOzH9hzd7dG8KumnPbdZvVSGMb7Nt7Er9iipa+cDnbh/TdYQ2lOJVHKRhsEy7NFPT5rLR22xh58H2ESaFjdPnC1/c+oxOaEj9+ggohEaiWpQJS4FS+dIT2ZwoNGRN/wmpfxCyZQoNt+2TJVZW"},
+ {decoded: new Uint8Array([54, 214, 176, 218, 145, 47, 237, 21, 24, 53, 74, 32, 122, 222, 226, 9, 0, 215, 8, 61, 83, 189, 231, 164, 215, 228, 102, 179, 89, 11, 33, 67, 61, 188, 19, 232, 79, 79, 217, 248, 77, 64, 149, 95, 246, 171, 94, 43, 255, 90, 160, 88, 0, 228, 9, 179, 193, 243, 210, 6, 109, 183, 52, 72, 42, 14, 90, 133, 78, 135, 83, 146, 248, 163, 182, 218, 129, 121, 54, 50, 217, 201, 60, 248, 178, 169, 117, 164, 61, 172, 233, 255, 151, 104, 21, 58, 174, 94, 110, 60, 224, 87, 24, 180, 66, 110, 137, 143, 74, 219, 55, 26, 57, 103, 99, 55, 128, 55, 55, 195, 223, 185, 242, 65, 11, 191, 124, 216, 128, 77, 8, 176, 87, 246, 67, 189, 46, 34, 78, 128, 182, 220, 136, 32, 90, 0, 179, 21, 50, 30, 164, 214, 191, 129, 189, 234, 68, 99, 85]),
+ encoded: "Ntaw2pEv7RUYNUoget7iCQDXCD1Tveek1+Rms1kLIUM9vBPoT0/Z+E1AlV/2q14r/1qgWADkCbPB89IGbbc0SCoOWoVOh1OS+KO22oF5NjLZyTz4sql1pD2s6f+XaBU6rl5uPOBXGLRCbomPSts3GjlnYzeANzfD37nyQQu/fNiATQiwV/ZDvS4iToC23IggWgCzFTIepNa/gb3qRGNV"},
+ {decoded: new Uint8Array([166, 57, 12, 234, 146, 115, 131, 201, 248, 120, 27, 48, 145, 111, 174, 248, 6, 204, 45, 69, 94, 26, 209, 37, 158, 198, 162, 157, 34, 110, 28, 96, 224, 147, 181, 206, 52, 175, 15, 239, 151, 73, 136, 131, 122, 72]),
+ encoded: "pjkM6pJzg8n4eBswkW+u+AbMLUVeGtElnsainSJuHGDgk7XONK8P75dJiIN6SA=="},
+ {decoded: new Uint8Array([33, 214, 229, 86, 78, 103, 76, 210, 124, 16, 243, 105, 73, 183, 193, 132, 217, 154, 187, 135, 187, 223, 39, 215, 1, 152, 1, 208, 184, 27, 137, 215, 239, 189, 129, 24, 218, 149, 167, 151, 205, 191, 141, 255, 186, 251, 100, 21, 208, 69, 235, 252, 192, 241, 222, 175, 137, 238]),
+ encoded: "IdblVk5nTNJ8EPNpSbfBhNmau4e73yfXAZgB0LgbidfvvYEY2pWnl82/jf+6+2QV0EXr/MDx3q+J7g=="},
+ {decoded: new Uint8Array([131, 213, 140, 141, 204, 115, 149, 140, 113, 235, 63, 191, 240, 157, 161, 36, 72, 139, 216, 27, 172, 20, 86, 48, 1, 164, 193, 193, 108, 99, 97, 194, 90, 166, 37, 208, 218, 239, 188, 193, 91, 243, 215, 27, 11, 8, 229, 120, 217, 121, 79, 253, 216, 162, 61, 100, 230, 232, 15, 95, 129, 245, 137, 63, 144, 3, 110, 244, 143, 120, 196, 74, 164, 126, 116, 126, 187, 111, 166, 166, 106, 117, 154, 21, 142, 168, 58, 188, 39, 154, 233, 16, 79, 209, 103, 221, 201, 197, 61, 101, 74, 89, 7, 58, 187, 181, 156, 142, 189, 163, 168, 110, 6, 249, 162, 109, 161, 94, 132, 65, 85, 190, 20, 181, 145, 181, 4, 145, 137, 11, 243, 103, 102, 141, 73, 196, 24, 32, 255, 150, 71, 181, 232, 148, 207, 43, 167, 181, 73, 236, 152, 182, 51, 108, 196, 91, 180, 32, 235, 111, 199, 143, 36, 238, 6, 9, 88, 113, 29, 29, 205, 130, 3, 90, 255, 241, 2, 214, 212, 58, 125, 127, 155, 210, 47, 131, 207, 168, 134, 32, 95, 219, 14, 68, 74, 74, 14, 148, 187, 187, 116, 166, 146, 247, 163, 36, 171, 29, 161, 26, 152, 31, 223, 174, 1, 53, 246, 142, 205, 145, 162, 153, 175, 101, 12, 44, 85, 79, 237, 143, 45, 195, 222, 73, 20, 232, 5, 223, 148, 39, 139, 152, 117, 25, 3, 212, 223, 123, 245, 86, 216, 154, 97, 7, 158, 192, 49, 239, 180, 77, 180, 184, 77, 41, 52, 97, 56, 179, 108, 120, 149, 4, 148, 133, 112, 213, 236, 61, 194, 45, 52, 80, 238, 135, 29, 180, 4, 144, 178, 107, 140, 171, 166, 162, 99, 255, 202, 48, 124, 97, 53, 111, 239, 203, 176, 245, 149, 62, 189, 12, 211, 80, 67, 25, 44, 82, 62, 82, 15, 179, 79, 247, 35, 123, 175, 58, 13, 1, 161, 32, 146, 30, 48, 116, 46, 36, 46, 183, 236, 127, 57, 27, 53, 31, 12, 72, 88, 128, 31, 129, 100, 138, 76, 60, 228, 133, 138, 139, 43, 59, 197, 187, 64, 42, 186, 84, 168, 255, 139, 184, 79, 169, 20, 101, 253, 223, 230, 182, 46, 34, 216, 207, 211, 111, 223, 90, 139, 147, 58, 102, 82, 144, 196, 190, 164, 217, 244, 246, 19, 128, 216, 186, 246, 5, 142, 203, 36, 129, 234, 79, 154, 63, 72, 53, 102, 3, 130, 109, 180, 27, 216, 153, 99, 118, 99, 42, 210, 160, 62, 217, 233, 234, 122, 83, 131, 92, 125, 61, 205, 18, 20, 119, 222, 44, 180, 185, 126, 72, 54, 126, 174, 68, 47, 184, 156, 207, 208, 246, 199, 104, 57, 72, 126, 210, 42, 110, 119, 33, 146, 161, 238, 233, 246, 18, 211, 216, 198, 183, 172, 14, 28, 208, 210, 4, 92, 188, 240, 60, 57, 161, 27, 6, 236, 162, 172, 216, 122, 16, 222, 225, 216, 200, 107, 25, 29, 200, 46, 212, 235, 181, 121, 139, 105, 31, 49, 208, 127, 185, 96, 198, 18, 235, 184, 186, 146, 43, 230, 160, 228, 21, 237, 227, 54, 191, 253, 117, 56, 50, 232, 118, 104, 216, 224, 220, 8, 127, 141, 205, 0, 248, 152, 146, 10, 236, 6, 50, 236, 134, 180, 23, 176, 87, 205, 201, 216, 15, 208, 159, 98, 242, 250, 92, 201, 72, 91, 141, 50, 249, 84, 13, 76, 49, 78, 121, 128, 194, 16, 200, 10, 141, 228, 13, 69, 5, 110, 179, 98, 5, 22, 241, 228, 48, 186, 45, 234, 78, 92, 157, 135, 251, 73, 12, 191, 3, 189, 239, 179, 219, 4, 38, 254, 13, 249, 251, 246]),
+ encoded: "g9WMjcxzlYxx6z+/8J2hJEiL2BusFFYwAaTBwWxjYcJapiXQ2u+8wVvz1xsLCOV42XlP/diiPWTm6A9fgfWJP5ADbvSPeMRKpH50frtvpqZqdZoVjqg6vCea6RBP0WfdycU9ZUpZBzq7tZyOvaOobgb5om2hXoRBVb4UtZG1BJGJC/NnZo1JxBgg/5ZHteiUzyuntUnsmLYzbMRbtCDrb8ePJO4GCVhxHR3NggNa//EC1tQ6fX+b0i+Dz6iGIF/bDkRKSg6Uu7t0ppL3oySrHaEamB/frgE19o7NkaKZr2UMLFVP7Y8tw95JFOgF35Qni5h1GQPU33v1VtiaYQeewDHvtE20uE0pNGE4s2x4lQSUhXDV7D3CLTRQ7ocdtASQsmuMq6aiY//KMHxhNW/vy7D1lT69DNNQQxksUj5SD7NP9yN7rzoNAaEgkh4wdC4kLrfsfzkbNR8MSFiAH4Fkikw85IWKiys7xbtAKrpUqP+LuE+pFGX93+a2LiLYz9Nv31qLkzpmUpDEvqTZ9PYTgNi69gWOyySB6k+aP0g1ZgOCbbQb2JljdmMq0qA+2enqelODXH09zRIUd94stLl+SDZ+rkQvuJzP0PbHaDlIftIqbnchkqHu6fYS09jGt6wOHNDSBFy88Dw5oRsG7KKs2HoQ3uHYyGsZHcgu1Ou1eYtpHzHQf7lgxhLruLqSK+ag5BXt4za//XU4Muh2aNjg3Ah/jc0A+JiSCuwGMuyGtBewV83J2A/Qn2Ly+lzJSFuNMvlUDUwxTnmAwhDICo3kDUUFbrNiBRbx5DC6LepOXJ2H+0kMvwO977PbBCb+Dfn79g=="}];
+}
diff --git a/bindings/typescript/test/testgen/tg_b64.erl b/bindings/typescript/test/testgen/tg_b64.erl
new file mode 100644
index 0000000..e88c1c0
--- /dev/null
+++ b/bindings/typescript/test/testgen/tg_b64.erl
@@ -0,0 +1,106 @@
+%% base64 test generation
+-module(tg_b64).
+
+-compile(export_all).
+-compile(nowarn_export_all).
+
+%% todo: write assertio function
+%% assert input/output pairs
+
+single_cases() ->
+ IOPairs = [{<<>>, <<>>} | single_cases(0, [])],
+ unicode:characters_to_list(
+ ["[", js_pairs(IOPairs, []), "]"]
+ ).
+
+
+single_cases(Byte, Acc) when 0 =< Byte, Byte =< 255 ->
+ ThisPair = {<>, base64:encode(<>)},
+ NewByte = Byte + 1,
+ NewAcc = [ThisPair | Acc],
+ single_cases(NewByte, NewAcc);
+single_cases(256, Acc) ->
+ Acc.
+
+
+
+
+cases(N) ->
+ IOPairs = rand_cases(N),
+ unicode:characters_to_list(
+ ["[", js_pairs(IOPairs, []), "]"]
+ ).
+
+
+% last one
+js_pairs([Pair], Acc) ->
+ [Acc, js_pair(Pair)];
+js_pairs([Pair | Rest], Acc) ->
+ NewAcc = [Acc, js_pair(Pair), ",\n "],
+ js_pairs(Rest, NewAcc).
+
+
+js_pair({Base64_Decoded, Base64_Encoded}) ->
+ unicode:characters_to_list(
+ ["{decoded: ", encode_decoded(Base64_Decoded), ",\n"
+ " encoded: ", encode_encoded(Base64_Encoded), "}"]
+ ).
+
+
+
+
+
+
+
+rand_cases(N) ->
+ rand_cases(N, []).
+
+rand_cases(0, Acc) ->
+ Acc;
+rand_cases(N, Acc) when 1 =< N ->
+ Input_Bytes = rand_data(),
+ Output_Bytes = base64:encode(Input_Bytes),
+ NewN = N - 1,
+ NewAcc = [{Input_Bytes, Output_Bytes} | Acc],
+ rand_cases(NewN, NewAcc).
+
+
+
+-spec rand_data() -> RandomBytes
+ when RandomBytes :: binary().
+
+rand_data() ->
+ % anything between 0 and 999 bytes
+ NBytes = rand:uniform(1000) - 1,
+ Rand255 = fun() -> rand:uniform(256) - 1 end,
+ << <<( Rand255() ):8>>
+ || _ <- lists:seq(1, NBytes)
+ >>.
+
+
+
+-spec encode_decoded(Base64_Decoded) -> JS_String
+ when Base64_Decoded :: binary(),
+ JS_String :: string().
+
+encode_decoded(Bytes) ->
+ unicode:characters_to_list(["new Uint8Array([",
+ encode_ns(Bytes, []),
+ "])"]).
+
+encode_ns(<<>>, Acc) ->
+ Acc;
+encode_ns(<>, Acc) ->
+ [Acc, integer_to_list(LastByte)];
+encode_ns(<>, Acc) ->
+ NewAcc = [Acc, integer_to_list(Byte), ", "],
+ encode_ns(Rest, NewAcc).
+
+
+
+-spec encode_encoded(Base64_Encoded) -> Js_String
+ when Base64_Encoded :: binary(),
+ Js_String :: string().
+
+encode_encoded(Base64_Encoded) ->
+ unicode:characters_to_list([$", Base64_Encoded, $"]).
diff --git a/bindings/typescript/test/tsconfig.json b/bindings/typescript/test/tsconfig.json
new file mode 100644
index 0000000..f240cdc
--- /dev/null
+++ b/bindings/typescript/test/tsconfig.json
@@ -0,0 +1,16 @@
+{"compilerOptions" : {"target" : "es2022",
+ "strict" : true,
+ "esModuleInterop" : true,
+ "skipLibCheck" : true,
+ "forceConsistentCasingInFileNames" : true,
+ "noImplicitAny" : true,
+ "strictNullChecks" : true,
+ "strictPropertyInitialization" : true,
+ "sourceMap" : true,
+ "outDir" : "dist",
+ "declaration" : true},
+ "$schema" : "https://json.schemastore.org/tsconfig",
+ "display" : "Recommended",
+ "include" : ["src/**/*"],
+ "exclude" : ["src/jex_include"],
+ "composite" : true}