1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 11:57:34 +00:00

Libraries: Move to Userland/Libraries/

This commit is contained in:
Andreas Kling 2021-01-12 12:17:30 +01:00
parent dc28c07fa5
commit 13d7c09125
1857 changed files with 266 additions and 274 deletions

View file

@ -0,0 +1,36 @@
function isPositiveZero(value) {
return value === 0 && 1 / value === Infinity;
}
function isNegativeZero(value) {
return value === 0 && 1 / value === -Infinity;
}
test("basic functionality", () => {
expect(Math.sign).toHaveLength(1);
expect(Math.sign(0.0001)).toBe(1);
expect(Math.sign(1)).toBe(1);
expect(Math.sign(42)).toBe(1);
expect(Math.sign(Infinity)).toBe(1);
expect(isPositiveZero(Math.sign(0))).toBeTrue();
expect(isPositiveZero(Math.sign(null))).toBeTrue();
expect(isPositiveZero(Math.sign(""))).toBeTrue();
expect(isPositiveZero(Math.sign([]))).toBeTrue();
expect(Math.sign(-0.0001)).toBe(-1);
expect(Math.sign(-1)).toBe(-1);
expect(Math.sign(-42)).toBe(-1);
expect(Math.sign(-Infinity)).toBe(-1);
expect(isNegativeZero(Math.sign(-0))).toBeTrue();
expect(isNegativeZero(Math.sign(-null))).toBeTrue();
expect(isNegativeZero(Math.sign(-""))).toBeTrue();
expect(isNegativeZero(Math.sign(-[]))).toBeTrue();
expect(Math.sign()).toBeNaN();
expect(Math.sign(undefined)).toBeNaN();
expect(Math.sign([1, 2, 3])).toBeNaN();
expect(Math.sign({})).toBeNaN();
expect(Math.sign(NaN)).toBeNaN();
expect(Math.sign("foo")).toBeNaN();
});