js/src/jit-test/tests/ion/mathFloor.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 // Test Math.floor() for IonMonkey.
     2 // Requires --ion-eager to enter at the top of each loop.
     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 ];
    26 var floorITests = [
    27 	[0, 0],
    28 	[4, 4],
    29 	[-1, -1],
    30 	[-7, -7],
    31 	[2147483648, 2147483648],
    32 	[-2147483649, -2147483649]
    33 ];
    35 // Typed functions to be compiled by Ion.
    36 function floorD(x) { return Math.floor(x); }
    37 function floorI(x) { return Math.floor(x); }
    39 function test() {
    40 	// Always run this function in the interpreter.
    41 	try {} catch (e) {}
    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 }
    49 for (var i = 0; i < 40; i++)
    50 	test();

mercurial