]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/plus-boolean-exit.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / plus-boolean-exit.js
1 function foo(a, b) {
2 return 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, 43);
15
16 // Now try some unexpected things, in descending order of possible badness.
17 test(true, 2147483647, 2147483648);
18 test(false, 42, 42);
19 test(1, 2, 3);
20 test(true, true, 2);
21 test(1.5, 1.5, 3);
22