tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

mathFloor.js (1082B)


      1 // Test Math.floor() for IonMonkey.
      2 // Requires --ion-eager to enter at the top of each loop.
      3 
      4 var floorDTests = [
      5 [-0, -0],
      6 [0.49999999999999997, 0],
      7 [0.5, 0],
      8 [1.0, 1],
      9 [1.5, 1],
     10 [792.8, 792],
     11 [-0.1, -1],
     12 [-1.0001, -2],
     13 [-3.14, -4],
     14 [2137483649.5, 2137483649],
     15 [2137483648.5, 2137483648],
     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 ];
     25 
     26 var floorITests = [
     27 [0, 0],
     28 [4, 4],
     29 [-1, -1],
     30 [-7, -7],
     31 [2147483648, 2147483648],
     32 [-2147483649, -2147483649]
     33 ];
     34 
     35 // Typed functions to be compiled by Ion.
     36 function floorD(x) { return Math.floor(x); }
     37 function floorI(x) { return Math.floor(x); }
     38 
     39 function test() {
     40 // Always run this function in the interpreter.
     41 with ({}) {}
     42 
     43 for (var i = 0; i < floorDTests.length; i++)
     44 	assertEq(floorD(floorDTests[i][0]), floorDTests[i][1]);
     45 for (var i = 0; i < floorITests.length; i++)
     46 	assertEq(floorI(floorITests[i][0]), floorITests[i][1]);
     47 }
     48 
     49 for (var i = 0; i < 40; i++)
     50 test();