summaryrefslogtreecommitdiffstats
path: root/js/src/tests/ecma_6/Number/ToNumber.js
blob: 5716c8a0005a8d7c2d4322bf4b2965a6b4b0e6f1 (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
/*
 * Any copyright is dedicated to the Public Domain.
 * https://creativecommons.org/publicdomain/zero/1.0/
 */

assertEq(Number("0b11"), 3);
assertEq(Number("0B11"), 3);
assertEq(Number(" 0b11 "), 3);
assertEq(Number("0b12"), NaN);
assertEq(Number("-0b11"), NaN);
assertEq(+"0b11", 3);

assertEq(Number("0o66"), 54);
assertEq(Number("0O66"), 54);
assertEq(Number(" 0o66 "), 54);
assertEq(Number("0o88"), NaN);
assertEq(Number("-0o66"), NaN);
assertEq(+"0o66", 54);

if(typeof getSelfHostedValue === "function"){
    assertEq(getSelfHostedValue("ToNumber")("0b11"), 3);
    assertEq(getSelfHostedValue("ToNumber")("0o66"), 54);
}

if (typeof reportCompare === "function")
    reportCompare(true, true);