summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/self-hosting/tolength.js
blob: 06fda18a724c2deb557a49238672f1dcf14e274f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
let ToLength = getSelfHostedValue('ToLength');

assertEq(ToLength(NaN), 0);
assertEq(ToLength(-0), 0);
assertEq(ToLength(0), 0);
assertEq(ToLength(-Infinity), 0);
assertEq(ToLength(-Math.pow(2, 31)), 0);

const MAX = Math.pow(2, 53) - 1;
assertEq(ToLength(Infinity), MAX);
assertEq(ToLength(MAX + 1), MAX);
assertEq(ToLength(3), 3);
assertEq(ToLength(40.5), 40);