summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/bug1123064.js
blob: 517bb8d46ac964aa266628f12958e442d103987a (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
30
function toint32() {

    // The test case to trigger MToNumberInt32 operation.
    var ToInteger = getSelfHostedValue("ToInteger");

    // Case1: The input operand is constant int32.
    var result = ToInteger(1);
    assertEq(result, 1);

    // Case2: The input operand is constant double.
    result = ToInteger(0.12);
    assertEq(result, 0);

    // Case3: The input operand is constant float.
    result = ToInteger(Math.fround(0.13));
    assertEq(result, 0);

    // Case4: The input operand is constant boolean.
    result = ToInteger(true);
    assertEq(result, 1);

    // Case5: The input operand is null.
    result = ToInteger(null);
    assertEq(result, 0);
}

toint32();
toint32();