js/src/tests/ecma_6/Math/sign.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 // If x is NaN, the result is NaN.
     2 assertEq(Math.sign(NaN), NaN);
     4 // If x is −0, the result is −0.
     5 assertEq(Math.sign(-0), -0);
     7 // If x is +0, the result is +0.
     8 assertEq(Math.sign(+0), +0);
    10 // If x is negative and not −0, the result is −1.
    11 assertEq(Math.sign(-Number.MIN_VALUE), -1);
    12 assertEq(Math.sign(-Number.MAX_VALUE), -1);
    13 assertEq(Math.sign(-Infinity), -1);
    15 for (var i = -1; i > -20; i--)
    16     assertEq(Math.sign(i), -1);
    18 assertEq(Math.sign(-1e-300), -1);
    19 assertEq(Math.sign(-0x80000000), -1);
    21 // If x is positive and not +0, the result is +1.
    22 assertEq(Math.sign(Number.MIN_VALUE), +1);
    23 assertEq(Math.sign(Number.MAX_VALUE), +1);
    24 assertEq(Math.sign(Infinity), +1);
    26 for (var i = 1; i < 20; i++)
    27     assertEq(Math.sign(i), +1);
    29 assertEq(Math.sign(+1e-300), +1);
    30 assertEq(Math.sign(0x80000000), +1);
    31 assertEq(Math.sign(0xffffffff), +1);
    34 reportCompare(0, 0, "ok");

mercurial