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.

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

mercurial