summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Tests/isNaN.js
blob: 7519b68fd227b79e84964d050af95bde556f9171 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
load("test-common.js");

try {
    assert(isNaN.length === 1);

    assert(isNaN(0) === false);
    assert(isNaN(42) === false);
    assert(isNaN("") === false);
    assert(isNaN("0") === false);
    assert(isNaN("42") === false);
    assert(isNaN(true) === false);
    assert(isNaN(false) === false);
    assert(isNaN(null) === false);
    assert(isNaN([]) === false);
    assert(isNaN(Infinity) === false);
    assert(isNaN(-Infinity) === false);

    assert(isNaN() === true);
    assert(isNaN(NaN) === true);
    assert(isNaN(undefined) === true);
    assert(isNaN("foo") === true);
    assert(isNaN({}) === true);
    assert(isNaN([1, 2, 3]) === true);

    console.log("PASS");
} catch (e) {
    console.log("FAIL: " + e.message);
}