summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/number-isnan.js
blob: 78e8345918445a71103d53913da00f8fd902dd47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
assertEq(Number.isNaN(NaN), true);
assertEq(Number.isNaN(0/0), true);
assertEq(Number.isNaN(Number("NaN")), true);
assertEq(Number.isNaN(4), false);
assertEq(Number.isNaN(4.5), false);
assertEq(Number.isNaN("hi"), false);
assertEq(Number.isNaN("1.3"), false);
assertEq(Number.isNaN("51"), false);
assertEq(Number.isNaN(0), false);
assertEq(Number.isNaN(-0), false);
assertEq(Number.isNaN({valueOf: function () { return 3; }}), false);
assertEq(Number.isNaN({valueOf: function () { return 0/0; }}), false);
assertEq(Number.isNaN({ valueOf: function() { throw 17; } }), false);
assertEq(Number.isNaN({ toString: function() { throw 17; } }), false);
assertEq(Number.isNaN({ valueOf: function() { throw 17; }, toString: function() { throw 42; } }), false);