blob: c6779f33fae47d7cb5f1e9c7f8a0bf7026bc7fff [file] [log] [blame]
//@ runBigIntEnabled
function assert(a, message) {
if (!a)
throw new Error(message);
}
function assertThrowRangeError(a, b) {
try {
let n = a ** b;
assert(false, "Should throw RangeError, but executed without exception");
} catch (e) {
assert(e instanceof RangeError, "Expected RangeError, got: " + e);
}
}
assertThrowRangeError(1n, -1n);
assertThrowRangeError(0n, -1n);
assertThrowRangeError(-1n, -1n);
assertThrowRangeError(1n, -100000000000000000n);