mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 11:45:06 +00:00
LibJS: Implement Infinity
This commit is contained in:
parent
40b3203941
commit
543c6e00db
5 changed files with 40 additions and 0 deletions
27
Libraries/LibJS/Tests/Infinity-basic.js
Normal file
27
Libraries/LibJS/Tests/Infinity-basic.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
function assert(x) { if (!x) throw 1; }
|
||||
|
||||
try {
|
||||
assert(Infinity + "" === "Infinity");
|
||||
assert(-Infinity + "" === "-Infinity");
|
||||
assert(Infinity === Infinity);
|
||||
assert(Infinity - 1 === Infinity);
|
||||
assert(Infinity + 1 === Infinity);
|
||||
assert(-Infinity === -Infinity);
|
||||
assert(-Infinity - 1 === -Infinity);
|
||||
assert(-Infinity + 1 === -Infinity);
|
||||
assert(1 / Infinity === 0);
|
||||
assert(1 / -Infinity === 0);
|
||||
assert(1 / 0 === Infinity);
|
||||
assert(-1 / 0 === -Infinity);
|
||||
assert(-100 < Infinity);
|
||||
assert(0 < Infinity);
|
||||
assert(100 < Infinity);
|
||||
assert(-Infinity < Infinity);
|
||||
assert(-100 > -Infinity);
|
||||
assert(0 > -Infinity);
|
||||
assert(100 > -Infinity);
|
||||
assert(Infinity > -Infinity);
|
||||
console.log("PASS");
|
||||
} catch (e) {
|
||||
console.log("FAIL: " + e);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue