diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/non262/Math/clz32.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/non262/Math/clz32.js')
-rw-r--r-- | js/src/tests/non262/Math/clz32.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/js/src/tests/non262/Math/clz32.js b/js/src/tests/non262/Math/clz32.js new file mode 100644 index 0000000000..0062676365 --- /dev/null +++ b/js/src/tests/non262/Math/clz32.js @@ -0,0 +1,40 @@ +// Undefined and NaN end up as zero after ToUint32 +assertEq(Math.clz32(), 32); +assertEq(Math.clz32(NaN), 32); +assertEq(Math.clz32.call(), 32); +// 0 +assertEq(Math.clz32(null), 32); +assertEq(Math.clz32(false), 32); +// 1 +assertEq(Math.clz32(true), 31); +// 3 +assertEq(Math.clz32(3.5), 30); +// NaN -> 0 +assertEq(Math.clz32({}), 32); +// 2 +assertEq(Math.clz32({valueOf: function() { return 2; }}), 30); +// 0 -> 0 +assertEq(Math.clz32([]), 32); +assertEq(Math.clz32(""), 32); +// NaN -> 0 +assertEq(Math.clz32([1, 2, 3]), 32); +assertEq(Math.clz32("bar"), 32); +// 15 +assertEq(Math.clz32("15"), 28); + + +assertEq(Math.clz32(0x80000000), 0); +assertEq(Math.clz32(0xF0FF1000), 0); +assertEq(Math.clz32(0x7F8F0001), 1); +assertEq(Math.clz32(0x3FFF0100), 2); +assertEq(Math.clz32(0x1FF50010), 3); +assertEq(Math.clz32(0x00800000), 8); +assertEq(Math.clz32(0x00400000), 9); +assertEq(Math.clz32(0x00008000), 16); +assertEq(Math.clz32(0x00004000), 17); +assertEq(Math.clz32(0x00000080), 24); +assertEq(Math.clz32(0x00000040), 25); +assertEq(Math.clz32(0x00000001), 31); +assertEq(Math.clz32(0), 32); + +reportCompare(0, 0, 'ok'); |