summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Tests/numeric-literals-basic.js
blob: 0b1f6249d61accecba14748307d8dc0db09f4a20 (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
29
load("test-common.js");

try {
    assert(0xff === 255);
    assert(0XFF === 255);
    assert(0o10 === 8);
    assert(0O10 === 8);
    assert(0b10 === 2);
    assert(0B10 === 2);
    assert(1e3 === 1000);
    assert(1e+3 === 1000);
    assert(1e-3 === 0.001);
    assert(1. === 1);
    assert(1.e1 === 10);
    assert(.1 === 0.1);
    assert(.1e1 === 1);
    assert(0.1e1 === 1);
    assert(.1e+1 === 1);
    assert(0.1e+1 === 1);

    Number.prototype.foo = 'LOL';
    assert(1..foo === 'LOL');
    assert(1.1.foo === 'LOL');
    assert(.1.foo === 'LOL');

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