1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
it("should not change positive input", () => {
return WebAssembly.instantiate(wasmmodule).then(m => {
const res = m.instance.exports.abs(0.5);
assert.typeOf(res, "number");
assert.equal(res, 0.5);
});
});
it("should flip negative input", () => {
return WebAssembly.instantiate(wasmmodule).then(m => {
const res = m.instance.exports.abs(-12341234);
assert.typeOf(res, "number");
assert.equal(res, 12341234);
});
});
it("should flip negative zero", () => {
return WebAssembly.instantiate(wasmmodule).then(m => {
const res = m.instance.exports.abs(-0);
assert.typeOf(res, "number");
assert.equal(res, 0);
});
});
|