mirror of https://github.com/tc39/test262.git
[javascriptcore-test262-automation] Changes from https://github.com/webkit/webkit.git at sha b85a66fba6 on Tue Nov 13 2018 18:55:51 GMT+0000 (Coordinated Universal Time)
This commit is contained in:
parent
5da519e25d
commit
23dc1e1d43
|
@ -0,0 +1,63 @@
|
|||
//@ runDefault("--useBigInt=true", "--useDFGJIT=false")
|
||||
|
||||
function assert(a, message) {
|
||||
if (!a)
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
function lshift(y) {
|
||||
let out = 1n;
|
||||
for (let i = 0; i < y; i++) {
|
||||
out *= 2n;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
let a = lshift(16384 * 63);
|
||||
for (let i = 0; i < 256; i++) {
|
||||
a *= 18446744073709551615n;
|
||||
}
|
||||
|
||||
try {
|
||||
let b = a + 1n;
|
||||
assert(false, "Should throw OutOfMemoryError, but executed without exception");
|
||||
} catch(e) {
|
||||
assert(e.message == "Out of memory", "Expected OutOfMemoryError, but got: " + e);
|
||||
}
|
||||
|
||||
try {
|
||||
let b = a - (-1n);
|
||||
assert(false, "Should throw OutOfMemoryError, but executed without exception");
|
||||
} catch(e) {
|
||||
assert(e.message == "Out of memory", "Expected OutOfMemoryError, but got: " + e);
|
||||
}
|
||||
|
||||
try {
|
||||
let b = a * (-1n);
|
||||
assert(false, "Should throw OutOfMemoryError, but executed without exception");
|
||||
} catch(e) {
|
||||
assert(e.message == "Out of memory", "Expected OutOfMemoryError, but got: " + e);
|
||||
}
|
||||
|
||||
try {
|
||||
let b = a / a;
|
||||
assert(false, "Should throw OutOfMemoryError, but executed without exception");
|
||||
} catch(e) {
|
||||
assert(e.message == "Out of memory", "Expected OutOfMemoryError, but got: " + e);
|
||||
}
|
||||
|
||||
try {
|
||||
let b = -a & -1n;
|
||||
assert(false, "Should throw OutOfMemoryError, but executed without exception");
|
||||
} catch(e) {
|
||||
assert(e.message == "Out of memory", "Expected OutOfMemoryError, but got: " + e);
|
||||
}
|
||||
|
||||
try {
|
||||
let b = a ^ -1n;
|
||||
assert(false, "Should throw OutOfMemoryError, but executed without exception");
|
||||
} catch(e) {
|
||||
assert(e.message == "Out of memory", "Expected OutOfMemoryError, but got: " + e);
|
||||
}
|
||||
|
Loading…
Reference in New Issue