]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/max-boolean-exit.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / max-boolean-exit.js
1 function foo(a, b) {
2 return Math.max(a.f, b.f);
3 }
4
5 noInline(foo);
6
7 function test(a, b, c) {
8 var result = foo({f:a}, {f:b});
9 if (result != c)
10 throw "Error: expected " + c + " but got: " + result;
11 }
12
13 for (var i = 0; i < 100000; ++i)
14 test(true, 42, 42);
15
16 // Now try some unexpected things, in descending order of possible badness.
17 test(true, 2147483647, 2147483647);
18 test(false, 42, 42);
19 test(1, 2, 2);
20 test(true, true, 1);
21 test(1.5, 1.5, 1.5);
22