1
0
mirror of https://github.com/SerenityOS/serenity synced 2024-07-09 06:40:45 +00:00

LibJS: Uncomment and add parseInt tests

Added another test that checks radices > 16, as well as uncommented
several "FIXME" tests that are now working.
This commit is contained in:
Idan Horowitz 2021-06-06 02:52:01 +03:00 committed by Linus Groh
parent aa5b144f90
commit 0bf597e99d

View File

@ -29,15 +29,15 @@ test("basic parseInt() functionality", () => {
expect(parseInt(4.7, 10)).toBe(4);
expect(parseInt("0e0", 16)).toBe(224);
expect(parseInt("123_456")).toBe(123);
// FIXME: expect(parseInt(4.7 * 1e22, 10)).toBe(4);
// FIXME: expect(parseInt(0.00000000000434, 10)).toBe(4);
// FIXME: expect(parseInt(0.0000001,11)).toBe(1);
// FIXME: expect(parseInt(0.000000124,10)).toBe(1);
// FIXME: expect(parseInt(1e-7,10)).toBe(1);
// FIXME: expect(parseInt(1000000000000100000000,10)).toBe(1);
// FIXME: expect(parseInt(123000000000010000000000,10)).toBe(1);
// FIXME: expect(parseInt(1e+21,10)).toBe(1);
expect(parseInt("UVWXYZ", 36)).toBe(1867590395);
expect(parseInt(4.7 * 1e22, 10)).toBe(4);
expect(parseInt(0.00000000000434, 10)).toBe(4);
expect(parseInt(0.0000001, 11)).toBe(1);
expect(parseInt(0.000000124, 10)).toBe(1);
expect(parseInt(1e-7, 10)).toBe(1);
expect(parseInt(1000000000000100000000, 10)).toBe(1);
expect(parseInt(123000000000010000000000, 10)).toBe(1);
expect(parseInt(1e21, 10)).toBe(1);
// FIXME: expect(parseInt('900719925474099267n')).toBe(900719925474099300)
});