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 /*
2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/licenses/publicdomain/
4 */
6 function testInt(n, result) {
7 var x = 0;
8 for (var i = 0; i < 15; i++) {
9 assertEq(parseInt(n, 10), result);
10 assertEq(parseInt(n, 0), result);
11 assertEq(parseInt(n), result);
12 assertEq(parseInt(n, x), result);
14 if (x % 2 == 0)
15 x = 10;
16 else
17 x = 0;
18 }
19 }
21 function testDouble(n, result) {
22 var x = 0;
23 for (var i = 0; i < 15; i++) {
24 assertEq(parseInt(n, 10), result);
25 assertEq(parseInt(n, 0), result);
26 assertEq(parseInt(n), result);
27 assertEq(parseInt(n, x), result);
29 if (x % 2 == 0)
30 x = 10;
31 else
32 x = 0;
33 }
34 }
36 testInt(2147483647, 2147483647);
37 testInt(-2147483648, -2147483648);
38 testInt(17, 17);
39 testInt(-1, -1);
40 testInt(0, 0);
42 testDouble(1e21, 1);
43 testDouble(-5.7, -5);
44 testDouble(1.7, 1);
45 testDouble(1.0e-6, 0);
46 testDouble(1.0e-7, 1);
47 testDouble(NaN, NaN);
48 testDouble(1e20, 1e20);