summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/truncateToInt32-ool.js
blob: dd3d9c99abbb28b4c8cd7ed5e2289b35b89d2006 (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
function f (x) {
    return x >> 0;
}

var table = [
    [NaN, 0],

    [Infinity, 0],
    [-Infinity, 0],
    [0, 0],
    [-0, 0],

    [15, 15],
    [-15, -15],

    [0x80000000, -0x80000000],
    [-0x80000000, -0x80000000],

    [0xffffffff, -1],
    [-0xffffffff, 1],

    [0x7fffffff, 0x7fffffff],
    [-0x7fffffff, -0x7fffffff]
]

for (var i = 0; i < table.length; i++) {    
    assertEq(f(table[i][0]), table[i][1]);
}