1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:27:35 +00:00

LibJS: Convert most builtin tests to new system

This commit is contained in:
Matthew Olsson 2020-07-04 10:09:48 -07:00 committed by Andreas Kling
parent 46581773c1
commit 3f97d75778
107 changed files with 2031 additions and 2243 deletions

View file

@ -1,19 +1,13 @@
load("test-common.js");
test("basic functionality", () => {
expect(Math.expm1).toHaveLength(1);
try {
assert(Math.expm1.length === 1);
expect(Math.expm1(0)).toBe(0);
expect(Math.expm1(-2)).toBeCloseTo(-0.864664);
expect(Math.expm1(-1)).toBeCloseTo(-0.632120);
expect(Math.expm1(1)).toBeCloseTo(1.718281);
expect(Math.expm1(2)).toBeCloseTo(6.389056);
assert(Math.expm1(0) === 0);
assert(isClose(Math.expm1(-2), -0.864664));
assert(isClose(Math.expm1(-1), -0.632120));
assert(isClose(Math.expm1(1), 1.718281));
assert(isClose(Math.expm1(2), 6.389056));
assert(isNaN(Math.expm1()));
assert(isNaN(Math.expm1(undefined)));
assert(isNaN(Math.expm1("foo")));
console.log("PASS");
} catch (e) {
console.log("FAIL: " + e);
}
expect(Math.expm1()).toBeNaN();
expect(Math.expm1(undefined)).toBeNaN();
expect(Math.expm1("foo")).toBeNaN();
});