summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/BigInt/asUintN
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/BigInt/asUintN')
-rw-r--r--js/src/tests/test262/built-ins/BigInt/asUintN/arithmetic.js71
-rw-r--r--js/src/tests/test262/built-ins/BigInt/asUintN/asUintN.js23
-rw-r--r--js/src/tests/test262/built-ins/BigInt/asUintN/bigint-tobigint-errors.js173
-rw-r--r--js/src/tests/test262/built-ins/BigInt/asUintN/bigint-tobigint-toprimitive.js169
-rw-r--r--js/src/tests/test262/built-ins/BigInt/asUintN/bigint-tobigint-wrapped-values.js64
-rw-r--r--js/src/tests/test262/built-ins/BigInt/asUintN/bigint-tobigint.js51
-rw-r--r--js/src/tests/test262/built-ins/BigInt/asUintN/bits-toindex-errors.js88
-rw-r--r--js/src/tests/test262/built-ins/BigInt/asUintN/bits-toindex-toprimitive.js169
-rw-r--r--js/src/tests/test262/built-ins/BigInt/asUintN/bits-toindex-wrapped-values.js111
-rw-r--r--js/src/tests/test262/built-ins/BigInt/asUintN/bits-toindex.js37
-rw-r--r--js/src/tests/test262/built-ins/BigInt/asUintN/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/BigInt/asUintN/length.js22
-rw-r--r--js/src/tests/test262/built-ins/BigInt/asUintN/name.js22
-rw-r--r--js/src/tests/test262/built-ins/BigInt/asUintN/not-a-constructor.js28
-rw-r--r--js/src/tests/test262/built-ins/BigInt/asUintN/order-of-steps.js34
-rw-r--r--js/src/tests/test262/built-ins/BigInt/asUintN/shell.js0
16 files changed, 1062 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/BigInt/asUintN/arithmetic.js b/js/src/tests/test262/built-ins/BigInt/asUintN/arithmetic.js
new file mode 100644
index 0000000000..443f13c60c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/BigInt/asUintN/arithmetic.js
@@ -0,0 +1,71 @@
+// Copyright (C) 2017 Josh Wolfe. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-bigint.asuintn
+description: BigInt.asUintN arithmetic test cases
+info: |
+ BigInt.asUintN ( bits, bigint )
+
+ 3. Return a BigInt representing bigint modulo 2**bits.
+
+features: [BigInt]
+---*/
+
+assert.sameValue(BigInt.asUintN(0, -2n), 0n);
+assert.sameValue(BigInt.asUintN(0, -1n), 0n);
+assert.sameValue(BigInt.asUintN(0, 0n), 0n);
+assert.sameValue(BigInt.asUintN(0, 1n), 0n);
+assert.sameValue(BigInt.asUintN(0, 2n), 0n);
+
+assert.sameValue(BigInt.asUintN(1, -3n), 1n);
+assert.sameValue(BigInt.asUintN(1, -2n), 0n);
+assert.sameValue(BigInt.asUintN(1, -1n), 1n);
+assert.sameValue(BigInt.asUintN(1, 0n), 0n);
+assert.sameValue(BigInt.asUintN(1, 1n), 1n);
+assert.sameValue(BigInt.asUintN(1, 2n), 0n);
+assert.sameValue(BigInt.asUintN(1, 3n), 1n);
+assert.sameValue(BigInt.asUintN(1, -123456789012345678901n), 1n);
+assert.sameValue(BigInt.asUintN(1, -123456789012345678900n), 0n);
+assert.sameValue(BigInt.asUintN(1, 123456789012345678900n), 0n);
+assert.sameValue(BigInt.asUintN(1, 123456789012345678901n), 1n);
+
+assert.sameValue(BigInt.asUintN(2, -3n), 1n);
+assert.sameValue(BigInt.asUintN(2, -2n), 2n);
+assert.sameValue(BigInt.asUintN(2, -1n), 3n);
+assert.sameValue(BigInt.asUintN(2, 0n), 0n);
+assert.sameValue(BigInt.asUintN(2, 1n), 1n);
+assert.sameValue(BigInt.asUintN(2, 2n), 2n);
+assert.sameValue(BigInt.asUintN(2, 3n), 3n);
+assert.sameValue(BigInt.asUintN(2, -123456789012345678901n), 3n);
+assert.sameValue(BigInt.asUintN(2, -123456789012345678900n), 0n);
+assert.sameValue(BigInt.asUintN(2, 123456789012345678900n), 0n);
+assert.sameValue(BigInt.asUintN(2, 123456789012345678901n), 1n);
+
+assert.sameValue(BigInt.asUintN(8, 0xabn), 0xabn);
+assert.sameValue(BigInt.asUintN(8, 0xabcdn), 0xcdn);
+assert.sameValue(BigInt.asUintN(8, 0xabcdef01n), 0x01n);
+assert.sameValue(BigInt.asUintN(8, 0xabcdef0123456789abcdef0123n), 0x23n);
+assert.sameValue(BigInt.asUintN(8, 0xabcdef0123456789abcdef0183n), 0x83n);
+
+assert.sameValue(BigInt.asUintN(64, 0xabcdef0123456789abcdefn), 0x0123456789abcdefn);
+assert.sameValue(BigInt.asUintN(65, 0xabcdef0123456789abcdefn), 0x10123456789abcdefn);
+
+assert.sameValue(BigInt.asUintN(200,
+ 0xbffffffffffffffffffffffffffffffffffffffffffffffffffn),
+ 0x0ffffffffffffffffffffffffffffffffffffffffffffffffffn
+);
+assert.sameValue(BigInt.asUintN(201,
+ 0xbffffffffffffffffffffffffffffffffffffffffffffffffffn),
+ 0x1ffffffffffffffffffffffffffffffffffffffffffffffffffn
+);
+
+assert.sameValue(BigInt.asUintN(200,
+ 0xb89e081df68b65fedb32cffea660e55df9605650a603ad5fc54n),
+ 0x089e081df68b65fedb32cffea660e55df9605650a603ad5fc54n
+);
+assert.sameValue(BigInt.asUintN(201,
+ 0xb89e081df68b65fedb32cffea660e55df9605650a603ad5fc54n),
+ 0x189e081df68b65fedb32cffea660e55df9605650a603ad5fc54n
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/BigInt/asUintN/asUintN.js b/js/src/tests/test262/built-ins/BigInt/asUintN/asUintN.js
new file mode 100644
index 0000000000..195b536eaf
--- /dev/null
+++ b/js/src/tests/test262/built-ins/BigInt/asUintN/asUintN.js
@@ -0,0 +1,23 @@
+// Copyright (C) 2017 Josh Wolfe. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-bigint.asuintn
+description: BigInt.asUintN property descriptor
+info: |
+ BigInt.asUintN ( bits, bigint )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+features: [BigInt]
+---*/
+
+assert.sameValue(typeof BigInt.asUintN, 'function');
+
+verifyProperty(BigInt, "asUintN", {
+ enumerable: false,
+ writable: true,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/BigInt/asUintN/bigint-tobigint-errors.js b/js/src/tests/test262/built-ins/BigInt/asUintN/bigint-tobigint-errors.js
new file mode 100644
index 0000000000..031b946704
--- /dev/null
+++ b/js/src/tests/test262/built-ins/BigInt/asUintN/bigint-tobigint-errors.js
@@ -0,0 +1,173 @@
+// Copyright (C) 2017 Josh Wolfe. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: BigInt.asUintN type coercion for bigint parameter
+esid: sec-bigint.asuintn
+info: |
+ BigInt.asUintN ( bits, bigint )
+
+ 2. Let bigint ? ToBigInt(bigint).
+features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
+---*/
+assert.sameValue(typeof BigInt, 'function');
+assert.sameValue(typeof BigInt.asUintN, 'function');
+
+assert.throws(TypeError, function () {
+ BigInt.asUintN();
+}, "ToBigInt: no argument => undefined => TypeError");
+assert.throws(TypeError, function () {
+ BigInt.asUintN(0);
+}, "ToBigInt: no argument => undefined => TypeError");
+
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, undefined);
+}, "ToBigInt: undefined => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, {
+ [Symbol.toPrimitive]: function() {
+ return undefined;
+ }
+ });
+}, "ToBigInt: @@toPrimitive => undefined => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, {
+ valueOf: function() {
+ return undefined;
+ }
+ });
+}, "ToBigInt: valueOf => undefined => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, {
+ toString: function() {
+ return undefined;
+ }
+ });
+}, "ToBigInt: toString => undefined => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, null);
+}, "ToBigInt: null => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, {
+ [Symbol.toPrimitive]: function() {
+ return null;
+ }
+ });
+}, "ToBigInt: @@toPrimitive => null => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, {
+ valueOf: function() {
+ return null;
+ }
+ });
+}, "ToBigInt: valueOf => null => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, {
+ toString: function() {
+ return null;
+ }
+ });
+}, "ToBigInt: toString => null => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, 0);
+}, "ToBigInt: Number => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, Object(0));
+}, "ToBigInt: unbox object with internal slot => Number => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, {
+ [Symbol.toPrimitive]: function() {
+ return 0;
+ }
+ });
+}, "ToBigInt: @@toPrimitive => Number => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, {
+ valueOf: function() {
+ return 0;
+ }
+ });
+}, "ToBigInt: valueOf => Number => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, {
+ toString: function() {
+ return 0;
+ }
+ });
+}, "ToBigInt: toString => Number => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, NaN);
+}, "ToBigInt: Number => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, Infinity);
+}, "ToBigInt: Number => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, Symbol("1"));
+}, "ToBigInt: Symbol => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, Object(Symbol("1")));
+}, "ToBigInt: unbox object with internal slot => Symbol => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, {
+ [Symbol.toPrimitive]: function() {
+ return Symbol("1");
+ }
+ });
+}, "ToBigInt: @@toPrimitive => Symbol => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, {
+ valueOf: function() {
+ return Symbol("1");
+ }
+ });
+}, "ToBigInt: valueOf => Symbol => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, {
+ toString: function() {
+ return Symbol("1");
+ }
+ });
+}, "ToBigInt: toString => Symbol => TypeError");
+assert.throws(SyntaxError, function() {
+ BigInt.asUintN(0, "a");
+}, "ToBigInt: unparseable BigInt");
+assert.throws(SyntaxError, function() {
+ BigInt.asUintN(0, "0b2");
+}, "ToBigInt: unparseable BigInt binary");
+assert.throws(SyntaxError, function() {
+ BigInt.asUintN(0, Object("0b2"));
+}, "ToBigInt: unbox object with internal slot => unparseable BigInt binary");
+assert.throws(SyntaxError, function() {
+ BigInt.asUintN(0, {
+ [Symbol.toPrimitive]: function() {
+ return "0b2";
+ }
+ });
+}, "ToBigInt: @@toPrimitive => unparseable BigInt binary");
+assert.throws(SyntaxError, function() {
+ BigInt.asUintN(0, {
+ valueOf: function() {
+ return "0b2";
+ }
+ });
+}, "ToBigInt: valueOf => unparseable BigInt binary");
+assert.throws(SyntaxError, function() {
+ BigInt.asUintN(0, {
+ toString: function() {
+ return "0b2";
+ }
+ });
+}, "ToBigInt: toString => unparseable BigInt binary");
+assert.throws(SyntaxError, function() {
+ BigInt.asUintN(0, " 0b2 ");
+}, "ToBigInt: unparseable BigInt with leading/trailing whitespace");
+assert.throws(SyntaxError, function() {
+ BigInt.asUintN(0, "0o8");
+}, "ToBigInt: unparseable BigInt octal");
+assert.throws(SyntaxError, function() {
+ BigInt.asUintN(0, "0xg");
+}, "ToBigInt: unparseable BigInt hex");
+assert.throws(SyntaxError, function() {
+ BigInt.asUintN(0, "1n");
+}, "ToBigInt: unparseable BigInt due to literal suffix");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/BigInt/asUintN/bigint-tobigint-toprimitive.js b/js/src/tests/test262/built-ins/BigInt/asUintN/bigint-tobigint-toprimitive.js
new file mode 100644
index 0000000000..bda1fca2d8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/BigInt/asUintN/bigint-tobigint-toprimitive.js
@@ -0,0 +1,169 @@
+// Copyright (C) 2017 Josh Wolfe. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: BigInt.asUintN type coercion for bigint parameter
+esid: sec-bigint.asuintn
+info: |
+ BigInt.asUintN ( bits, bigint )
+
+ 2. Let bigint ? ToBigInt(bigint).
+features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
+---*/
+assert.sameValue(typeof BigInt, 'function');
+assert.sameValue(typeof BigInt.asUintN, 'function');
+
+function err() {
+ throw new Test262Error();
+}
+
+function MyError() {}
+
+assert.sameValue(BigInt.asUintN(2, {
+ [Symbol.toPrimitive]: function() {
+ return "1";
+ },
+ valueOf: err,
+ toString: err
+}), 1n, "ToPrimitive: @@toPrimitive takes precedence");
+assert.sameValue(BigInt.asUintN(2, {
+ valueOf: function() {
+ return "1";
+ },
+ toString: err
+}), 1n, "ToPrimitive: valueOf takes precedence over toString");
+assert.sameValue(BigInt.asUintN(2, {
+ toString: function() {
+ return "1";
+ }
+}), 1n, "ToPrimitive: toString with no valueOf");
+assert.sameValue(BigInt.asUintN(2, {
+ [Symbol.toPrimitive]: undefined,
+ valueOf: function() {
+ return "1";
+ }
+}), 1n, "ToPrimitive: skip @@toPrimitive when it's undefined");
+assert.sameValue(BigInt.asUintN(2, {
+ [Symbol.toPrimitive]: null,
+ valueOf: function() {
+ return "1";
+ }
+}), 1n, "ToPrimitive: skip @@toPrimitive when it's null");
+assert.sameValue(BigInt.asUintN(2, {
+ valueOf: null,
+ toString: function() {
+ return "1";
+ }
+}), 1n, "ToPrimitive: skip valueOf when it's not callable");
+assert.sameValue(BigInt.asUintN(2, {
+ valueOf: 1,
+ toString: function() {
+ return "1";
+ }
+}), 1n, "ToPrimitive: skip valueOf when it's not callable");
+assert.sameValue(BigInt.asUintN(2, {
+ valueOf: {},
+ toString: function() {
+ return "1";
+ }
+}), 1n, "ToPrimitive: skip valueOf when it's not callable");
+assert.sameValue(BigInt.asUintN(2, {
+ valueOf: function() {
+ return {};
+ },
+ toString: function() {
+ return "1";
+ }
+}), 1n, "ToPrimitive: skip valueOf when it returns an object");
+assert.sameValue(BigInt.asUintN(2, {
+ valueOf: function() {
+ return Object(12345);
+ },
+ toString: function() {
+ return "1";
+ }
+}), 1n, "ToPrimitive: skip valueOf when it returns an object");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, {
+ [Symbol.toPrimitive]: 1
+ });
+}, "ToPrimitive: throw when @@toPrimitive is not callable");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, {
+ [Symbol.toPrimitive]: {}
+ });
+}, "ToPrimitive: throw when @@toPrimitive is not callable");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, {
+ [Symbol.toPrimitive]: function() {
+ return Object(1);
+ }
+ });
+}, "ToPrimitive: throw when @@toPrimitive returns an object");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, {
+ [Symbol.toPrimitive]: function() {
+ return {};
+ }
+ });
+}, "ToPrimitive: throw when @@toPrimitive returns an object");
+assert.throws(MyError, function() {
+ BigInt.asUintN(0, {
+ [Symbol.toPrimitive]: function() {
+ throw new MyError();
+ }
+ });
+}, "ToPrimitive: propagate errors from @@toPrimitive");
+assert.throws(MyError, function() {
+ BigInt.asUintN(0, {
+ valueOf: function() {
+ throw new MyError();
+ }
+ });
+}, "ToPrimitive: propagate errors from valueOf");
+assert.throws(MyError, function() {
+ BigInt.asUintN(0, {
+ toString: function() {
+ throw new MyError();
+ }
+ });
+}, "ToPrimitive: propagate errors from toString");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, {
+ valueOf: null,
+ toString: null
+ });
+}, "ToPrimitive: throw when skipping both valueOf and toString");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, {
+ valueOf: 1,
+ toString: 1
+ });
+}, "ToPrimitive: throw when skipping both valueOf and toString");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, {
+ valueOf: {},
+ toString: {}
+ });
+}, "ToPrimitive: throw when skipping both valueOf and toString");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, {
+ valueOf: function() {
+ return Object(1);
+ },
+ toString: function() {
+ return Object(1);
+ }
+ });
+}, "ToPrimitive: throw when skipping both valueOf and toString");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0, {
+ valueOf: function() {
+ return {};
+ },
+ toString: function() {
+ return {};
+ }
+ });
+}, "ToPrimitive: throw when skipping both valueOf and toString");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/BigInt/asUintN/bigint-tobigint-wrapped-values.js b/js/src/tests/test262/built-ins/BigInt/asUintN/bigint-tobigint-wrapped-values.js
new file mode 100644
index 0000000000..1c4105114a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/BigInt/asUintN/bigint-tobigint-wrapped-values.js
@@ -0,0 +1,64 @@
+// Copyright (C) 2017 Josh Wolfe. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: BigInt.asUintN type coercion for bigint parameter
+esid: sec-bigint.asuintn
+info: |
+ BigInt.asUintN ( bits, bigint )
+
+ 2. Let bigint ? ToBigInt(bigint).
+features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
+---*/
+
+assert.sameValue(BigInt.asUintN(2, Object(0n)), 0n, "ToPrimitive: unbox object with internal slot");
+assert.sameValue(BigInt.asUintN(2, {
+ [Symbol.toPrimitive]: function() {
+ return 0n;
+ }
+}), 0n, "ToPrimitive: @@toPrimitive");
+assert.sameValue(BigInt.asUintN(2, {
+ valueOf: function() {
+ return 0n;
+ }
+}), 0n, "ToPrimitive: valueOf");
+assert.sameValue(BigInt.asUintN(2, {
+ toString: function() {
+ return 0n;
+ }
+}), 0n, "ToPrimitive: toString");
+assert.sameValue(BigInt.asUintN(2, Object(true)), 1n,
+ "ToBigInt: unbox object with internal slot => true => 1n");
+assert.sameValue(BigInt.asUintN(2, {
+ [Symbol.toPrimitive]: function() {
+ return true;
+ }
+}), 1n, "ToBigInt: @@toPrimitive => true => 1n");
+assert.sameValue(BigInt.asUintN(2, {
+ valueOf: function() {
+ return true;
+ }
+}), 1n, "ToBigInt: valueOf => true => 1n");
+assert.sameValue(BigInt.asUintN(2, {
+ toString: function() {
+ return true;
+ }
+}), 1n, "ToBigInt: toString => true => 1n");
+assert.sameValue(BigInt.asUintN(2, Object("1")), 1n,
+ "ToBigInt: unbox object with internal slot => parse BigInt");
+assert.sameValue(BigInt.asUintN(2, {
+ [Symbol.toPrimitive]: function() {
+ return "1";
+ }
+}), 1n, "ToBigInt: @@toPrimitive => parse BigInt");
+assert.sameValue(BigInt.asUintN(2, {
+ valueOf: function() {
+ return "1";
+ }
+}), 1n, "ToBigInt: valueOf => parse BigInt");
+assert.sameValue(BigInt.asUintN(2, {
+ toString: function() {
+ return "1";
+ }
+}), 1n, "ToBigInt: toString => parse BigInt");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/BigInt/asUintN/bigint-tobigint.js b/js/src/tests/test262/built-ins/BigInt/asUintN/bigint-tobigint.js
new file mode 100644
index 0000000000..37e2da165a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/BigInt/asUintN/bigint-tobigint.js
@@ -0,0 +1,51 @@
+// Copyright (C) 2017 Josh Wolfe. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: BigInt.asUintN type coercion for bigint parameter
+esid: sec-bigint.asuintn
+info: |
+ BigInt.asUintN ( bits, bigint )
+
+ 2. Let bigint ? ToBigInt(bigint).
+features: [BigInt]
+---*/
+
+assert.sameValue(BigInt.asUintN(2, 0n), 0n);
+assert.sameValue(BigInt.asUintN(2, -0n), 0n);
+assert.sameValue(BigInt.asUintN(2, false), 0n, "ToBigInt: false => 0n");
+assert.sameValue(BigInt.asUintN(2, true), 1n, "ToBigInt: true => 1n");
+assert.sameValue(BigInt.asUintN(2, "1"), 1n, "ToBigInt: parse BigInt");
+assert.sameValue(BigInt.asUintN(2, "-0"), 0n, "ToBigInt: parse BigInt");
+assert.sameValue(BigInt.asUintN(2, ""), 0n, "ToBigInt: empty String => 0n");
+assert.sameValue(BigInt.asUintN(2, " "), 0n, "ToBigInt: String with only whitespace => 0n");
+assert.sameValue(BigInt.asUintN(2, []), 0n, "ToBigInt: .toString() => empty String => 0n");
+assert.sameValue(BigInt.asUintN(2, [1]), 1n, "ToBigInt: .toString() => parse BigInt");
+assert.sameValue(BigInt.asUintN(3, 10n), 2n);
+assert.sameValue(BigInt.asUintN(3, "10"), 2n, "ToBigInt: parse BigInt");
+assert.sameValue(BigInt.asUintN(3, "0b1010"), 2n, "ToBigInt: parse BigInt binary");
+assert.sameValue(BigInt.asUintN(3, "0o12"), 2n, "ToBigInt: parse BigInt octal");
+assert.sameValue(BigInt.asUintN(3, "0xa"), 2n, "ToBigInt: parse BigInt hex");
+assert.sameValue(BigInt.asUintN(3, " 0xa "), 2n,
+ "ToBigInt: parse BigInt ignore leading/trailing whitespace");
+assert.sameValue(BigInt.asUintN(3, " 10 "), 2n,
+ "ToBigInt: parse BigInt ignore leading/trailing whitespace");
+assert.sameValue(BigInt.asUintN(3, [10n]), 2n, "ToBigInt: .toString() => parse BigInt");
+assert.sameValue(BigInt.asUintN(3, ["10"]), 2n, "ToBigInt: .toString() => parse BigInt");
+assert.sameValue(BigInt.asUintN(4, 12345678901234567890003n), 3n);
+assert.sameValue(BigInt.asUintN(4, "12345678901234567890003"), 3n, "ToBigInt: parse BigInt");
+assert.sameValue(BigInt.asUintN(4,
+ "0b10100111010100001010110110010011100111011001110001010000100100010001010011"), 3n,
+ "ToBigInt: parse BigInt binary");
+assert.sameValue(BigInt.asUintN(4, "0o2472412662347316120442123"), 3n,
+ "ToBigInt: parse BigInt octal");
+assert.sameValue(BigInt.asUintN(4, "0x29d42b64e7671424453"), 3n, "ToBigInt: parse BigInt hex");
+assert.sameValue(BigInt.asUintN(4, " 0x29d42b64e7671424453 "), 3n,
+ "ToBigInt: parse BigInt ignore leading/trailing whitespace");
+assert.sameValue(BigInt.asUintN(4, " 12345678901234567890003 "), 3n,
+ "ToBigInt: parse BigInt ignore leading/trailing whitespace");
+assert.sameValue(BigInt.asUintN(4, [12345678901234567890003n]), 3n,
+ "ToBigInt: .toString() => parse BigInt");
+assert.sameValue(BigInt.asUintN(4, ["12345678901234567890003"]), 3n,
+ "ToBigInt: .toString() => parse BigInt");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/BigInt/asUintN/bits-toindex-errors.js b/js/src/tests/test262/built-ins/BigInt/asUintN/bits-toindex-errors.js
new file mode 100644
index 0000000000..59280fbdc2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/BigInt/asUintN/bits-toindex-errors.js
@@ -0,0 +1,88 @@
+// Copyright (C) 2017 Josh Wolfe. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: BigInt.asUintN type coercion for bits parameter
+esid: sec-bigint.asuintn
+info: |
+ BigInt.asUintN ( bits, bigint )
+
+ 1. Let bits be ? ToIndex(bits).
+features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
+---*/
+assert.sameValue(typeof BigInt, 'function');
+assert.sameValue(typeof BigInt.asUintN, 'function');
+
+assert.throws(RangeError, function() {
+ BigInt.asUintN(-1, 0n);
+}, "ToIndex: throw when integerIndex < 0");
+assert.throws(RangeError, function() {
+ BigInt.asUintN(-2.5, 0n);
+}, "ToIndex: throw when integerIndex < 0");
+assert.throws(RangeError, function() {
+ BigInt.asUintN("-2.5", 0n);
+}, "ToIndex: parse Number => throw when integerIndex < 0");
+assert.throws(RangeError, function() {
+ BigInt.asUintN(-Infinity, 0n);
+}, "ToIndex: throw when integerIndex < 0");
+assert.throws(RangeError, function() {
+ BigInt.asUintN(9007199254740992, 0n);
+}, "ToIndex: throw when integerIndex > 2**53-1");
+assert.throws(RangeError, function() {
+ BigInt.asUintN(Infinity, 0n);
+}, "ToIndex: throw when integerIndex > 2**53-1");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(0n, 0n);
+}, "ToIndex: BigInt => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(Object(0n), 0n);
+}, "ToIndex: unbox object with internal slot => BigInt => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN({
+ [Symbol.toPrimitive]: function() {
+ return 0n;
+ }
+ }, 0n);
+}, "ToIndex: @@toPrimitive => BigInt => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN({
+ valueOf: function() {
+ return 0n;
+ }
+ }, 0n);
+}, "ToIndex: valueOf => BigInt => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN({
+ toString: function() {
+ return 0n;
+ }
+ }, 0n);
+}, "ToIndex: toString => BigInt => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(Symbol("1"), 0n);
+}, "ToIndex: Symbol => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN(Object(Symbol("1")), 0n);
+}, "ToIndex: unbox object with internal slot => Symbol => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN({
+ [Symbol.toPrimitive]: function() {
+ return Symbol("1");
+ }
+ }, 0n);
+}, "ToIndex: @@toPrimitive => Symbol => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN({
+ valueOf: function() {
+ return Symbol("1");
+ }
+ }, 0n);
+}, "ToIndex: valueOf => Symbol => TypeError");
+assert.throws(TypeError, function() {
+ BigInt.asUintN({
+ toString: function() {
+ return Symbol("1");
+ }
+ }, 0n);
+}, "ToIndex: toString => Symbol => TypeError");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/BigInt/asUintN/bits-toindex-toprimitive.js b/js/src/tests/test262/built-ins/BigInt/asUintN/bits-toindex-toprimitive.js
new file mode 100644
index 0000000000..30008284c3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/BigInt/asUintN/bits-toindex-toprimitive.js
@@ -0,0 +1,169 @@
+// Copyright (C) 2017 Josh Wolfe. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: BigInt.asUintN type coercion for bits parameter
+esid: sec-bigint.asuintn
+info: |
+ BigInt.asUintN ( bits, bigint )
+
+ 1. Let bits be ? ToIndex(bits).
+features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
+---*/
+assert.sameValue(typeof BigInt, 'function');
+assert.sameValue(typeof BigInt.asUintN, 'function');
+
+function err() {
+ throw new Test262Error();
+}
+
+function MyError() {}
+
+assert.sameValue(BigInt.asUintN({
+ [Symbol.toPrimitive]: function() {
+ return 1;
+ },
+ valueOf: err,
+ toString: err
+}, 1n), 1n, "ToPrimitive: @@toPrimitive takes precedence");
+assert.sameValue(BigInt.asUintN({
+ valueOf: function() {
+ return 1;
+ },
+ toString: err
+}, 1n), 1n, "ToPrimitive: valueOf takes precedence over toString");
+assert.sameValue(BigInt.asUintN({
+ toString: function() {
+ return 1;
+ }
+}, 1n), 1n, "ToPrimitive: toString with no valueOf");
+assert.sameValue(BigInt.asUintN({
+ [Symbol.toPrimitive]: undefined,
+ valueOf: function() {
+ return 1;
+ }
+}, 1n), 1n, "ToPrimitive: skip @@toPrimitive when it's undefined");
+assert.sameValue(BigInt.asUintN({
+ [Symbol.toPrimitive]: null,
+ valueOf: function() {
+ return 1;
+ }
+}, 1n), 1n, "ToPrimitive: skip @@toPrimitive when it's null");
+assert.sameValue(BigInt.asUintN({
+ valueOf: null,
+ toString: function() {
+ return 1;
+ }
+}, 1n), 1n, "ToPrimitive: skip valueOf when it's not callable");
+assert.sameValue(BigInt.asUintN({
+ valueOf: 1,
+ toString: function() {
+ return 1;
+ }
+}, 1n), 1n, "ToPrimitive: skip valueOf when it's not callable");
+assert.sameValue(BigInt.asUintN({
+ valueOf: {},
+ toString: function() {
+ return 1;
+ }
+}, 1n), 1n, "ToPrimitive: skip valueOf when it's not callable");
+assert.sameValue(BigInt.asUintN({
+ valueOf: function() {
+ return {};
+ },
+ toString: function() {
+ return 1;
+ }
+}, 1n), 1n, "ToPrimitive: skip valueOf when it returns an object");
+assert.sameValue(BigInt.asUintN({
+ valueOf: function() {
+ return Object(12345);
+ },
+ toString: function() {
+ return 1;
+ }
+}, 1n), 1n, "ToPrimitive: skip valueOf when it returns an object");
+assert.throws(TypeError, function() {
+ BigInt.asUintN({
+ [Symbol.toPrimitive]: 1
+ }, 0n);
+}, "ToPrimitive: throw when @@toPrimitive is not callable");
+assert.throws(TypeError, function() {
+ BigInt.asUintN({
+ [Symbol.toPrimitive]: {}
+ }, 0n);
+}, "ToPrimitive: throw when @@toPrimitive is not callable");
+assert.throws(TypeError, function() {
+ BigInt.asUintN({
+ [Symbol.toPrimitive]: function() {
+ return Object(1);
+ }
+ }, 0n);
+}, "ToPrimitive: throw when @@toPrimitive returns an object");
+assert.throws(TypeError, function() {
+ BigInt.asUintN({
+ [Symbol.toPrimitive]: function() {
+ return {};
+ }
+ }, 0n);
+}, "ToPrimitive: throw when @@toPrimitive returns an object");
+assert.throws(MyError, function() {
+ BigInt.asUintN({
+ [Symbol.toPrimitive]: function() {
+ throw new MyError();
+ }
+ }, 0n);
+}, "ToPrimitive: propagate errors from @@toPrimitive");
+assert.throws(MyError, function() {
+ BigInt.asUintN({
+ valueOf: function() {
+ throw new MyError();
+ }
+ }, 0n);
+}, "ToPrimitive: propagate errors from valueOf");
+assert.throws(MyError, function() {
+ BigInt.asUintN({
+ toString: function() {
+ throw new MyError();
+ }
+ }, 0n);
+}, "ToPrimitive: propagate errors from toString");
+assert.throws(TypeError, function() {
+ BigInt.asUintN({
+ valueOf: null,
+ toString: null
+ }, 0n);
+}, "ToPrimitive: throw when skipping both valueOf and toString");
+assert.throws(TypeError, function() {
+ BigInt.asUintN({
+ valueOf: 1,
+ toString: 1
+ }, 0n);
+}, "ToPrimitive: throw when skipping both valueOf and toString");
+assert.throws(TypeError, function() {
+ BigInt.asUintN({
+ valueOf: {},
+ toString: {}
+ }, 0n);
+}, "ToPrimitive: throw when skipping both valueOf and toString");
+assert.throws(TypeError, function() {
+ BigInt.asUintN({
+ valueOf: function() {
+ return Object(1);
+ },
+ toString: function() {
+ return Object(1);
+ }
+ }, 0n);
+}, "ToPrimitive: throw when skipping both valueOf and toString");
+assert.throws(TypeError, function() {
+ BigInt.asUintN({
+ valueOf: function() {
+ return {};
+ },
+ toString: function() {
+ return {};
+ }
+ }, 0n);
+}, "ToPrimitive: throw when skipping both valueOf and toString");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/BigInt/asUintN/bits-toindex-wrapped-values.js b/js/src/tests/test262/built-ins/BigInt/asUintN/bits-toindex-wrapped-values.js
new file mode 100644
index 0000000000..ab18dcaf06
--- /dev/null
+++ b/js/src/tests/test262/built-ins/BigInt/asUintN/bits-toindex-wrapped-values.js
@@ -0,0 +1,111 @@
+// Copyright (C) 2017 Josh Wolfe. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: BigInt.asUintN type coercion for bits parameter
+esid: sec-bigint.asuintn
+info: |
+ BigInt.asUintN ( bits, bigint )
+
+ 1. Let bits be ? ToIndex(bits).
+features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
+---*/
+
+assert.sameValue(BigInt.asUintN(Object(0), 1n), 0n, "ToPrimitive: unbox object with internal slot");
+assert.sameValue(BigInt.asUintN({
+ [Symbol.toPrimitive]: function() {
+ return 0;
+ }
+}, 1n), 0n, "ToPrimitive: @@toPrimitive");
+assert.sameValue(BigInt.asUintN({
+ valueOf: function() {
+ return 0;
+ }
+}, 1n), 0n, "ToPrimitive: valueOf");
+assert.sameValue(BigInt.asUintN({
+ toString: function() {
+ return 0;
+ }
+}, 1n), 0n, "ToPrimitive: toString");
+assert.sameValue(BigInt.asUintN(Object(NaN), 1n), 0n,
+ "ToIndex: unbox object with internal slot => NaN => 0");
+assert.sameValue(BigInt.asUintN({
+ [Symbol.toPrimitive]: function() {
+ return NaN;
+ }
+}, 1n), 0n, "ToIndex: @@toPrimitive => NaN => 0");
+assert.sameValue(BigInt.asUintN({
+ valueOf: function() {
+ return NaN;
+ }
+}, 1n), 0n, "ToIndex: valueOf => NaN => 0");
+assert.sameValue(BigInt.asUintN({
+ toString: function() {
+ return NaN;
+ }
+}, 1n), 0n, "ToIndex: toString => NaN => 0");
+assert.sameValue(BigInt.asUintN({
+ [Symbol.toPrimitive]: function() {
+ return undefined;
+ }
+}, 1n), 0n, "ToIndex: @@toPrimitive => undefined => NaN => 0");
+assert.sameValue(BigInt.asUintN({
+ valueOf: function() {
+ return undefined;
+ }
+}, 1n), 0n, "ToIndex: valueOf => undefined => NaN => 0");
+assert.sameValue(BigInt.asUintN({
+ toString: function() {
+ return undefined;
+ }
+}, 1n), 0n, "ToIndex: toString => undefined => NaN => 0");
+assert.sameValue(BigInt.asUintN({
+ [Symbol.toPrimitive]: function() {
+ return null;
+ }
+}, 1n), 0n, "ToIndex: @@toPrimitive => null => 0");
+assert.sameValue(BigInt.asUintN({
+ valueOf: function() {
+ return null;
+ }
+}, 1n), 0n, "ToIndex: valueOf => null => 0");
+assert.sameValue(BigInt.asUintN({
+ toString: function() {
+ return null;
+ }
+}, 1n), 0n, "ToIndex: toString => null => 0");
+assert.sameValue(BigInt.asUintN(Object(true), 1n), 1n,
+ "ToIndex: unbox object with internal slot => true => 1");
+assert.sameValue(BigInt.asUintN({
+ [Symbol.toPrimitive]: function() {
+ return true;
+ }
+}, 1n), 1n, "ToIndex: @@toPrimitive => true => 1");
+assert.sameValue(BigInt.asUintN({
+ valueOf: function() {
+ return true;
+ }
+}, 1n), 1n, "ToIndex: valueOf => true => 1");
+assert.sameValue(BigInt.asUintN({
+ toString: function() {
+ return true;
+ }
+}, 1n), 1n, "ToIndex: toString => true => 1");
+assert.sameValue(BigInt.asUintN(Object("1"), 1n), 1n,
+ "ToIndex: unbox object with internal slot => parse Number");
+assert.sameValue(BigInt.asUintN({
+ [Symbol.toPrimitive]: function() {
+ return "1";
+ }
+}, 1n), 1n, "ToIndex: @@toPrimitive => parse Number");
+assert.sameValue(BigInt.asUintN({
+ valueOf: function() {
+ return "1";
+ }
+}, 1n), 1n, "ToIndex: valueOf => parse Number");
+assert.sameValue(BigInt.asUintN({
+ toString: function() {
+ return "1";
+ }
+}, 1n), 1n, "ToIndex: toString => parse Number");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/BigInt/asUintN/bits-toindex.js b/js/src/tests/test262/built-ins/BigInt/asUintN/bits-toindex.js
new file mode 100644
index 0000000000..f04dfa070e
--- /dev/null
+++ b/js/src/tests/test262/built-ins/BigInt/asUintN/bits-toindex.js
@@ -0,0 +1,37 @@
+// Copyright (C) 2017 Josh Wolfe. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: BigInt.asUintN type coercion for bits parameter
+esid: sec-bigint.asuintn
+info: |
+ BigInt.asUintN ( bits, bigint )
+
+ 1. Let bits be ? ToIndex(bits).
+features: [BigInt]
+---*/
+
+assert.sameValue(BigInt.asUintN(0, 1n), 0n);
+assert.sameValue(BigInt.asUintN(1, 1n), 1n);
+assert.sameValue(BigInt.asUintN(-0.9, 1n), 0n, "ToIndex: truncate towards 0");
+assert.sameValue(BigInt.asUintN(0.9, 1n), 0n, "ToIndex: truncate towards 0");
+assert.sameValue(BigInt.asUintN(NaN, 1n), 0n, "ToIndex: NaN => 0");
+assert.sameValue(BigInt.asUintN(undefined, 1n), 0n, "ToIndex: undefined => NaN => 0");
+assert.sameValue(BigInt.asUintN(null, 1n), 0n, "ToIndex: null => 0");
+assert.sameValue(BigInt.asUintN(false, 1n), 0n, "ToIndex: false => 0");
+assert.sameValue(BigInt.asUintN(true, 1n), 1n, "ToIndex: true => 1");
+assert.sameValue(BigInt.asUintN("0", 1n), 0n, "ToIndex: parse Number");
+assert.sameValue(BigInt.asUintN("1", 1n), 1n, "ToIndex: parse Number");
+assert.sameValue(BigInt.asUintN("", 1n), 0n, "ToIndex: parse Number => NaN => 0");
+assert.sameValue(BigInt.asUintN("foo", 1n), 0n, "ToIndex: parse Number => NaN => 0");
+assert.sameValue(BigInt.asUintN("true", 1n), 0n, "ToIndex: parse Number => NaN => 0");
+assert.sameValue(BigInt.asUintN(3, 10n), 2n);
+assert.sameValue(BigInt.asUintN("3", 10n), 2n, "toIndex: parse Number");
+assert.sameValue(BigInt.asUintN(3.9, 10n), 2n, "toIndex: truncate towards 0");
+assert.sameValue(BigInt.asUintN("3.9", 10n), 2n, "toIndex: parse Number => truncate towards 0");
+assert.sameValue(BigInt.asUintN([0], 1n), 0n, 'ToIndex: [0].toString() => "0" => 0');
+assert.sameValue(BigInt.asUintN(["1"], 1n), 1n, 'ToIndex: ["1"].toString() => "1" => 1');
+assert.sameValue(BigInt.asUintN({}, 1n), 0n,
+ 'ToIndex: ({}).toString() => "[object Object]" => NaN => 0');
+assert.sameValue(BigInt.asUintN([], 1n), 0n, 'ToIndex: [].toString() => "" => NaN => 0');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/BigInt/asUintN/browser.js b/js/src/tests/test262/built-ins/BigInt/asUintN/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/BigInt/asUintN/browser.js
diff --git a/js/src/tests/test262/built-ins/BigInt/asUintN/length.js b/js/src/tests/test262/built-ins/BigInt/asUintN/length.js
new file mode 100644
index 0000000000..8155411171
--- /dev/null
+++ b/js/src/tests/test262/built-ins/BigInt/asUintN/length.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2017 Josh Wolfe. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-bigint.asuintn
+description: BigInt.asUintN.length descriptor
+info: |
+ BigInt.asUintN ( bits, bigint )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+features: [BigInt]
+---*/
+
+verifyProperty(BigInt.asUintN, "length", {
+ value: 2,
+ enumerable: false,
+ writable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/BigInt/asUintN/name.js b/js/src/tests/test262/built-ins/BigInt/asUintN/name.js
new file mode 100644
index 0000000000..b3520892a2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/BigInt/asUintN/name.js
@@ -0,0 +1,22 @@
+// Copyright (C) 2017 Josh Wolfe. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-bigint.asuintn
+description: BigInt.asUintN.name descriptor
+info: |
+ BigInt.asUintN ( bits, bigint )
+
+ 17 ECMAScript Standard Built-in Objects
+
+includes: [propertyHelper.js]
+features: [BigInt]
+---*/
+
+verifyProperty(BigInt.asUintN, "name", {
+ value: "asUintN",
+ enumerable: false,
+ writable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/BigInt/asUintN/not-a-constructor.js b/js/src/tests/test262/built-ins/BigInt/asUintN/not-a-constructor.js
new file mode 100644
index 0000000000..e1208f5886
--- /dev/null
+++ b/js/src/tests/test262/built-ins/BigInt/asUintN/not-a-constructor.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ BigInt.asUintN does not implement [[Construct]], is not new-able
+info: |
+ ECMAScript Function Objects
+
+ Built-in function objects that are not identified as constructors do not
+ implement the [[Construct]] internal method unless otherwise specified in
+ the description of a particular function.
+
+ sec-evaluatenew
+
+ ...
+ 7. If IsConstructor(constructor) is false, throw a TypeError exception.
+ ...
+includes: [isConstructor.js]
+features: [Reflect.construct, BigInt, arrow-function]
+---*/
+assert.sameValue(isConstructor(BigInt.asUintN), false, 'isConstructor(BigInt.asUintN) must return false');
+
+assert.throws(TypeError, () => {
+ new BigInt.asUintN(64, 1n);
+}, '`new BigInt.asUintN(64, 1n)` throws TypeError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/BigInt/asUintN/order-of-steps.js b/js/src/tests/test262/built-ins/BigInt/asUintN/order-of-steps.js
new file mode 100644
index 0000000000..d957e66859
--- /dev/null
+++ b/js/src/tests/test262/built-ins/BigInt/asUintN/order-of-steps.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2017 Josh Wolfe. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-bigint.asuintn
+description: BigInt.asUintN order of parameter type coercion
+info: |
+ BigInt.asUintN ( bits, bigint )
+
+ 1. Let bits be ? ToIndex(bits).
+ 2. Let bigint ? ToBigInt(bigint).
+
+features: [BigInt]
+---*/
+
+var i = 0;
+var bits = {
+ valueOf() {
+ assert.sameValue(i, 0);
+ i++;
+ return 0;
+ }
+};
+var bigint = {
+ valueOf() {
+ assert.sameValue(i, 1);
+ i++;
+ return 0n;
+ }
+};
+
+BigInt.asUintN(bits, bigint);
+assert.sameValue(i, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/BigInt/asUintN/shell.js b/js/src/tests/test262/built-ins/BigInt/asUintN/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/BigInt/asUintN/shell.js