0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-31 09:14:20 -04:00
denoland-deno/cli/tests/051_wasm_import.ts

23 lines
659 B
TypeScript
Raw Normal View History

import { add, addImported, addRemote } from "./051_wasm_import/simple.wasm";
import { state } from "./051_wasm_import/wasm-dep.js";
function assertEquals(actual: unknown, expected: unknown, msg?: string): void {
if (actual !== expected) {
throw new Error(msg);
}
}
assertEquals(state, "WASM Start Executed", "Incorrect state");
assertEquals(add(10, 20), 30, "Incorrect add");
assertEquals(addImported(0), 42, "Incorrect addImported");
assertEquals(state, "WASM JS Function Executed", "Incorrect state");
assertEquals(addImported(1), 43, "Incorrect addImported");
assertEquals(addRemote(1), 2020, "Incorrect addRemote");
console.log("Passed");