Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 // Test Math.round() for IonMonkey.
2 // Requires --ion-eager to enter at the top of each loop.
4 var roundDTests = [
5 [-0, -0],
6 [0.49999999999999997, 1],
7 [0.5, 1],
8 [1.0, 1],
9 [1.5, 2],
10 [792.8, 793],
11 [-0.1, -0],
12 [-1.0001, -1],
13 [-3.14, -3],
14 [2137483649.5, 2137483650],
15 [2137483648.5, 2137483649],
16 [2137483647.1, 2137483647],
17 [900000000000, 900000000000],
18 [-0, -0],
19 [-Infinity, -Infinity],
20 [Infinity, Infinity],
21 [NaN, NaN],
22 [-2147483648.8, -2147483649],
23 [-2147483649.8, -2147483650]
24 ];
26 var roundITests = [
27 [0, 0],
28 [4, 4],
29 [2147483648, 2147483648],
30 [-2147483649, -2147483649]
31 ];
33 // Typed functions to be compiled by Ion.
34 function roundD(x) { return Math.round(x); }
35 function roundI(x) { return Math.round(x); }
37 function test() {
38 // Always run this function in the interpreter.
39 try {} catch (e) {}
41 for (var i = 0; i < roundDTests.length; i++)
42 assertEq(roundD(roundDTests[i][0]), roundDTests[i][1]);
43 for (var i = 0; i < roundITests.length; i++)
44 assertEq(roundI(roundITests[i][0]), roundITests[i][1]);
45 }
47 for (var i = 0; i < 40; i++)
48 test();