2020-07-04 10:09:48 -07:00
|
|
|
test("basic functionality", () => {
|
2020-07-06 07:37:45 -07:00
|
|
|
expect(Math.abs).toHaveLength(1);
|
2020-04-13 10:31:13 -07:00
|
|
|
|
2020-07-06 07:37:45 -07:00
|
|
|
expect(Math.abs("-1")).toBe(1);
|
|
|
|
|
expect(Math.abs(-2)).toBe(2);
|
|
|
|
|
expect(Math.abs(null)).toBe(0);
|
|
|
|
|
expect(Math.abs("")).toBe(0);
|
|
|
|
|
expect(Math.abs([])).toBe(0);
|
|
|
|
|
expect(Math.abs([2])).toBe(2);
|
|
|
|
|
expect(Math.abs([1, 2])).toBeNaN();
|
|
|
|
|
expect(Math.abs({})).toBeNaN();
|
|
|
|
|
expect(Math.abs("string")).toBeNaN();
|
|
|
|
|
expect(Math.abs()).toBeNaN();
|
2020-07-04 10:09:48 -07:00
|
|
|
});
|
2025-11-29 11:33:43 +00:00
|
|
|
|
|
|
|
|
test("i32 min value", () => {
|
|
|
|
|
expect(Math.abs(-2_147_483_648)).toBe(2_147_483_648);
|
|
|
|
|
});
|