ladybird/Userland/Libraries/LibJS/Tests/builtins/Math/Math.tan.js
davidot da8715a07c LibJS: Add extreme value tests for cos and sin
These sometimes produce different NaN patterns which can mess up the
value encoding.
2022-08-15 17:11:25 +02:00

16 lines
550 B
JavaScript

test("basic functionality", () => {
expect(Math.tan).toHaveLength(1);
expect(Math.tan(0)).toBe(0);
expect(Math.tan(null)).toBe(0);
expect(Math.tan("")).toBe(0);
expect(Math.tan([])).toBe(0);
expect(Math.ceil(Math.tan(Math.PI / 4))).toBe(1);
expect(Math.tan()).toBeNaN();
expect(Math.tan(undefined)).toBeNaN();
expect(Math.tan([1, 2, 3])).toBeNaN();
expect(Math.tan({})).toBeNaN();
expect(Math.tan("foo")).toBeNaN();
expect(Math.tan(Infinity)).toBeNaN();
expect(Math.tan(-Infinity)).toBeNaN();
});