]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/array-push-double-then-nan.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / array-push-double-then-nan.js
1 function foo(x) {
2 var array = [];
3 var result = [];
4 for (var i = 0; i < 42; ++i)
5 result.push(array.push(x));
6 return [array, result];
7 }
8
9 noInline(foo);
10
11 for (var i = 0; i < 100000; ++i) {
12 var result = foo(5.5);
13 if (result[0].toString() != "5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5,5.5")
14 throw "Error: bad array: " + result[0];
15 if (result[1].toString() != "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42")
16 throw "Error: bad array: " + result[1];
17 }
18
19 var result = foo(0/0);
20 if (result[0].toString() != "NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN")
21 throw "Error: bad array: " + result[0];
22 if (result[1].toString() != "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42")
23 throw "Error: bad array: " + result[1];