X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/4be4e30906bcb8ee30b4d189205cb70bad6707ce..81345200c95645a1b0d2635520f96ad55dfde63f:/tests/stress/float32-array-nan.js diff --git a/tests/stress/float32-array-nan.js b/tests/stress/float32-array-nan.js new file mode 100644 index 0000000..f74add8 --- /dev/null +++ b/tests/stress/float32-array-nan.js @@ -0,0 +1,20 @@ +function foo(o) { + return o[0]; +} + +noInline(foo); + +function test(a, x) { + var intArray = new Int32Array(1); + intArray[0] = a; + var floatArray = new Float32Array(intArray.buffer); + var element = foo(floatArray); + var result = element + 1; + if (("" + result) != ("" + x)) + throw "Error: bad result for " + a + ": " + result + ", but expected: " + x + "; loaded " + element + " from the array"; +} + +for (var i = 0; i < 100000; ++i) + test(0, 1); + +test(0xFFFF0000, 0/0);