ladybird/Userland/Libraries/LibJS/Tests/builtins/Math/Math.sin.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

17 lines
589 B
JavaScript

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