diff options
Diffstat (limited to '')
-rw-r--r-- | js/src/jit-test/tests/ion/math-max-arraylength.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/ion/math-max-arraylength.js b/js/src/jit-test/tests/ion/math-max-arraylength.js new file mode 100644 index 0000000000..dd8e915f84 --- /dev/null +++ b/js/src/jit-test/tests/ion/math-max-arraylength.js @@ -0,0 +1,25 @@ +var arrays = [ + [], + [1], + [1, 2], + [1, 2, 3], + [1, 2, 3, 4], +]; + +function test() { + for (var i = 0; i < arrays.length; i++) { + var array = arrays[i]; + + assertEq(Math.max(array.length, 0), i); + assertEq(Math.max(0, array.length), i); + + assertEq(Math.max(array.length, -1), i); + assertEq(Math.max(-1, array.length), i); + + assertEq(Math.max(array.length, -1.5), i); + assertEq(Math.max(-1.5, array.length), i); + } +} + +test(); +test(); |