Verified Commit 88d85c33 authored by nagayama15's avatar nagayama15

Update ammo.js test driver

parent 45065f7e
// ammo.js/tests/testutils.js require("./testutils");
globalThis.assert = (x, msg) => {
if (!x) throw "Assertion: " + (msg || "Failure") + " at " + new Error().stack;
};
globalThis.assertEq = (x, y, msg) =>
assert(
x === y,
(msg ? msg + " : " : "") + x + " should be equal to " + y + "."
);
globalThis.print = console.log;
// Run tests
const runTest = testname => { const runTest = testname => {
console.log(`Run test: ${testname}`); console.log(`Run test: ${testname}`);
globalThis.Ammo = require("./ammo.js/builds/ammo.wasm"); // `Ammo` must set every time :( globalThis.Ammo = require("./ammo.js/builds/ammo.wasm"); // `Ammo` must set every time :(
......
// ammo.js/tests/testutils.js
globalThis.assert = (x, msg) => {
if (!x) throw "Assertion: " + (msg || "Failure") + " at " + new Error().stack;
};
globalThis.assertEq = (x, y, msg) =>
assert(
x === y,
(msg ? msg + " : " : "") + x + " should be equal to " + y + "."
);
globalThis.print = console.log;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment