diff --git a/test/built-ins/BigInt/constructor-integer.js b/test/built-ins/BigInt/constructor-integer.js new file mode 100644 index 0000000000000000000000000000000000000000..36e37e60e64869716e5b5b2722edf3829ed55db0 --- /dev/null +++ b/test/built-ins/BigInt/constructor-integer.js @@ -0,0 +1,31 @@ +// Copyright (C) 2018 Igalia, S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +description: BigInt constructor called with integer argument +esid: sec-bigint-constructor +info: | + BigInt ( value ) + + ... + 3. If Type(prim) is Number, return ? NumberToBigInt(prim). + + NumberToBigInt ( number ) + + ... + 3. Return a BigInt representing the mathematical value of number. +features: [BigInt] +---*/ + +assert.sameValue(BigInt(Number.MAX_SAFE_INTEGER), 9007199254740991n); + +assert.sameValue(BigInt(-Number.MAX_SAFE_INTEGER), -9007199254740991n); + +var pos = Math.pow(2, 53); +var neg = -pos; + +assert.sameValue(BigInt(pos), 9007199254740992n, + "BigInt(2**53) === 9007199254740992n"); + +assert.sameValue(BigInt(neg), -9007199254740992n, + "BigInt(2**53) === -9007199254740992n"); diff --git a/test/built-ins/BigInt/issafeinteger-true.js b/test/built-ins/BigInt/issafeinteger-true.js deleted file mode 100644 index 1463edad3632b5822886a7e1ea962276a6f48ab5..0000000000000000000000000000000000000000 --- a/test/built-ins/BigInt/issafeinteger-true.js +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (C) 2017 Robin Templeton. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -description: Throws a TypeError if BigInt is called with a new target -esid: sec-bigint-constructor -info: | - ... - 3. If Type(prim) is Number, return ? NumberToBigInt(prim). - ... - - NumberToBigInt ( number ) - - 2. If IsSafeInteger(number) is false, throw a RangeError exception. - -features: [BigInt] ----*/ - -assert.sameValue(BigInt(Number.MAX_SAFE_INTEGER), 9007199254740991n); -assert.sameValue(BigInt(-Number.MAX_SAFE_INTEGER), -9007199254740991n); diff --git a/test/built-ins/BigInt/out-of-bounds-integer-rangeerror.js b/test/built-ins/BigInt/out-of-bounds-integer-rangeerror.js deleted file mode 100644 index cae05d72bdaddd0294e3d8b8bb04c4253205b015..0000000000000000000000000000000000000000 --- a/test/built-ins/BigInt/out-of-bounds-integer-rangeerror.js +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (C) 2017 Robin Templeton. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -description: BigInt throws a RangeError if value is not a safe integer. -esid: sec-bigint-constructor -info: | - BigInt ( value ) - - ... - 2. Let prim be ? ToPrimitive(value, hint Number). - 3. If Type(prim) is Number, return ? NumberToBigInt(prim). - ... - - NumberToBigInt ( number ) - - ... - 2. If IsSafeInteger(number) is false, throw a RangeError exception. - ... - - IsSafeInteger ( number ) - - ... - 3. Let integer be ToInteger(number). - 4. If integer is not equal to number, return false. - 5. If abs(integer) ≤ 2**53-1, return true. - 6. Otherwise, return false. -features: [BigInt] ----*/ - -var pos = Math.pow(2, 53); -var neg = -pos; - -assert.throws(RangeError, function() { - BigInt(pos); -}); - -assert.throws(RangeError, function() { - BigInt(neg); -}); diff --git a/test/built-ins/DataView/prototype/setBigInt64/set-values-return-undefined.js b/test/built-ins/DataView/prototype/setBigInt64/set-values-return-undefined.js index 4e2d481c1f0a8eefd4559178f8ff853b7f25fdaa..d60507eee3be57fc8bfeae49cdab571d5554cddb 100644 --- a/test/built-ins/DataView/prototype/setBigInt64/set-values-return-undefined.js +++ b/test/built-ins/DataView/prototype/setBigInt64/set-values-return-undefined.js @@ -1,4 +1,4 @@ -// Copyright (C) 2017 Igalia, S.L. All rights reserved. +// Copyright (C) 2018 Igalia, S.L. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- @@ -20,7 +20,7 @@ values.forEach(function(value, i) { () => sample.setBigInt64(0, BigInt(value), false), "value: " + value); return; - } else if (!Number.isInteger(value) || value > 9007199254740991) { + } else if (!Number.isInteger(value)) { assert.throws(RangeError, () => sample.setBigInt64(0, BigInt(value), false), "value " + value);