summaryrefslogtreecommitdiff
path: root/test/built-ins/TypedArray/prototype/copyWithin/BigInt
diff options
context:
space:
mode:
Diffstat (limited to 'test/built-ins/TypedArray/prototype/copyWithin/BigInt')
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js77
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js92
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js92
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/detached-buffer.js34
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/get-length-ignores-length-prop.js49
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-func.js29
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-method.js29
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js30
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js27
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js95
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js111
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js93
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js61
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js77
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js53
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js54
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js74
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js50
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js73
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js19
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end-is-symbol.js36
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end.js39
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start-is-symbol.js35
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start.js45
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target-is-symbol.js35
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target.js39
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js36
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-object.js50
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-typedarray-instance.js42
-rw-r--r--test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js45
30 files changed, 1621 insertions, 0 deletions
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js
new file mode 100644
index 000000000..6060fab6e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js
@@ -0,0 +1,77 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ end argument is coerced to an integer values.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 7. If end is undefined, let relativeEnd be len; else let relativeEnd be ?
+ ToInteger(end).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, null),
+ [0n, 1n, 2n, 3n]
+ ),
+ 'null value coerced to 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, NaN),
+ [0n, 1n, 2n, 3n]
+ ),
+ 'NaN value coerced to 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, false),
+ [0n, 1n, 2n, 3n]
+ ),
+ 'false value coerced to 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, true),
+ [0n, 0n, 2n, 3n]
+ ),
+ 'true value coerced to 1'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, '-2'),
+ [0n, 0n, 1n, 3n]
+ ),
+ 'string "-2" value coerced to integer -2'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, -2.5),
+ [0n, 0n, 1n, 3n]
+ ),
+ 'float -2.5 value coerced to integer -2'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js
new file mode 100644
index 000000000..6cd12a381
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js
@@ -0,0 +1,92 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ start argument is coerced to an integer value.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 5. Let relativeStart be ? ToInteger(start).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, undefined),
+ [0n, 0n, 1n, 2n]
+ ),
+ 'undefined value coerced to 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, false),
+ [0n, 0n, 1n, 2n]
+ ),
+ 'false value coerced to 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, NaN),
+ [0n, 0n, 1n, 2n]
+ ),
+ 'NaN value coerced to 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, null),
+ [0n, 0n, 1n, 2n]
+ ),
+ 'null value coerced to 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, true),
+ [1n, 2n, 3n, 3n]
+ ),
+ 'true value coerced to 1'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, '1'),
+ [1n, 2n, 3n, 3n]
+ ),
+ 'string "1" value coerced to 1'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0.5),
+ [0n, 0n, 1n, 2n]
+ ),
+ '0.5 float value coerced to integer 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1.5),
+ [1n, 2n, 3n, 3n]
+ ),
+ '1.5 float value coerced to integer 1'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js
new file mode 100644
index 000000000..92d409a46
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js
@@ -0,0 +1,92 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ target argument is coerced to an integer value.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 3. Let relativeTarget be ? ToInteger(target).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(undefined, 1),
+ [1n, 2n, 3n, 3n]
+ ),
+ 'undefined value coerced to 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(false, 1),
+ [1n, 2n, 3n, 3n]
+ ),
+ 'false value coerced to 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(NaN, 1),
+ [1n, 2n, 3n, 3n]
+ ),
+ 'NaN value coerced to 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(null, 1),
+ [1n, 2n, 3n, 3n]
+ ),
+ 'null value coerced to 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(true, 0),
+ [0n, 0n, 1n, 2n]
+ ),
+ 'true value coerced to 1'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin('1', 0),
+ [0n, 0n, 1n, 2n]
+ ),
+ 'string "1" value coerced to 1'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0.5, 1),
+ [1n, 2n, 3n, 3n]
+ ),
+ '0.5 float value coerced to integer 0'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1.5, 0),
+ [0n, 0n, 1n, 2n]
+ ),
+ '1.5 float value coerced to integer 1'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/detached-buffer.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/detached-buffer.js
new file mode 100644
index 000000000..0014ea674
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/detached-buffer.js
@@ -0,0 +1,34 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: Throws a TypeError if this has a detached buffer
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [, end ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ ...
+ 5. If IsDetachedBuffer(buffer) is true, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
+features: [BigInt, TypedArray]
+---*/
+
+var obj = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA(1);
+ $DETACHBUFFER(sample.buffer);
+ assert.throws(TypeError, function() {
+ sample.copyWithin(obj, obj);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/get-length-ignores-length-prop.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/get-length-ignores-length-prop.js
new file mode 100644
index 000000000..0de142b60
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/get-length-ignores-length-prop.js
@@ -0,0 +1,49 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Unreachable abrupt from Get(O, "length") as [[ArrayLength]] is returned.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ 1. Let O be ? ToObject(this value).
+ 2. Let len be ? ToLength(? Get(O, "length")).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+Object.defineProperty(TypedArray.prototype, "length", {
+ get: function() {
+ throw new Test262Error();
+ }
+});
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ Object.defineProperty(TA.prototype, "length", {
+ get: function() {
+ throw new Test262Error();
+ }
+ });
+
+ var sample = new TA();
+ Object.defineProperty(sample, "length", {
+ get: function() {
+ throw new Test262Error();
+ }
+ });
+
+ assert.sameValue(sample.copyWithin(0, 0), sample);
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-func.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-func.js
new file mode 100644
index 000000000..7559361e1
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-func.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: Throws a TypeError exception when invoked as a function
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [, end ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var copyWithin = TypedArray.prototype.copyWithin;
+
+assert.sameValue(typeof copyWithin, 'function');
+
+assert.throws(TypeError, function() {
+ copyWithin();
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-method.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-method.js
new file mode 100644
index 000000000..5a40d48c9
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-method.js
@@ -0,0 +1,29 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: Requires a [[TypedArrayName]] internal slot.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [, end ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+assert.sameValue(typeof TypedArrayPrototype.copyWithin, 'function');
+
+assert.throws(TypeError, function() {
+ TypedArrayPrototype.copyWithin();
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js
new file mode 100644
index 000000000..7c635e69c
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ %TypedArray%.prototype.copyWithin.length is 2.
+info: |
+ %TypedArray%.prototype.copyWithin (target, start [, end ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, has a length
+ property whose value is an integer. Unless otherwise specified, this
+ value is equal to the largest number of named arguments shown in the
+ subclause headings for the function description, including optional
+ parameters. However, rest parameters shown using the form “...name”
+ are not included in the default argument count.
+
+ Unless otherwise specified, the length property of a built-in Function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.copyWithin.length, 2);
+
+verifyNotEnumerable(TypedArray.prototype.copyWithin, "length");
+verifyNotWritable(TypedArray.prototype.copyWithin, "length");
+verifyConfigurable(TypedArray.prototype.copyWithin, "length");
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js
new file mode 100644
index 000000000..902c628c4
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2015 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ %TypedArray%.prototype.copyWithin.name is "copyWithin".
+info: |
+ %TypedArray%.prototype.copyWithin (target, start [, end ] )
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value
+ is a String.
+
+ Unless otherwise specified, the name property of a built-in Function
+ object, if it exists, has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(TypedArray.prototype.copyWithin.name, "copyWithin");
+
+verifyNotEnumerable(TypedArray.prototype.copyWithin, "name");
+verifyNotWritable(TypedArray.prototype.copyWithin, "name");
+verifyConfigurable(TypedArray.prototype.copyWithin, "name");
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js
new file mode 100644
index 000000000..78a8c9c9a
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js
@@ -0,0 +1,95 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Set values with negative end argument.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 7. If end is undefined, let relativeEnd be len; else let relativeEnd be ?
+ ToInteger(end).
+ 8. If relativeEnd < 0, let final be max((len + relativeEnd), 0); else let
+ final be min(relativeEnd, len).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, -1),
+ [1n, 2n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, 1, -1) -> [1, 2, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(2, 0, -1),
+ [0n, 1n, 0n, 1n, 2n]
+ ),
+ '[0, 1, 2, 3, 4].copyWithin(2, 0, -1) -> [0, 1, 0, 1, 2]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(1, 2, -2),
+ [0n, 2n, 2n, 3n, 4n]
+ ),
+ '[0, 1, 2, 3, 4].copyWithin(1, 2, -2) -> [0, 2, 2, 3, 4]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, -2, -1),
+ [2n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, -2, -1) -> [2, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(2, -2, -1),
+ [0n, 1n, 3n, 3n, 4n]
+ ),
+ '[0, 1, 2, 3, 4].copyWithin(2, -2, 1) -> [0, 1, 3, 3, 4]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(-3, -2, -1),
+ [0n, 2n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(-3, -2, -1) -> [0, 2, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-2, -3, -1),
+ [0n, 1n, 2n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3, 4].copyWithin(-2, -3, -1) -> [0, 1, 2, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-5, -2, -1),
+ [3n, 1n, 2n, 3n, 4n]
+ ),
+ '[0, 1, 2, 3, 4].copyWithin(-5, -2, -1) -> [3, 1, 2, 3, 4]'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js
new file mode 100644
index 000000000..ae1309824
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js
@@ -0,0 +1,111 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Set values with negative out of bounds end argument.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 7. If end is undefined, let relativeEnd be len; else let relativeEnd be ?
+ ToInteger(end).
+ 8. If relativeEnd < 0, let final be max((len + relativeEnd), 0); else let
+ final be min(relativeEnd, len).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, -10),
+ [0n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, 1, -10) -> [0, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, 1, -Infinity),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(0, 1, -Infinity) -> [1, 2, 3, 4, 5]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, -2, -10),
+ [0n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, -2, -10) -> [0, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, -2, -Infinity),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(0, -2, -Infinity) -> [1, 2, 3, 4, 5]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, -9, -10),
+ [0n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, -9, -10) -> [0, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, -9, -Infinity),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(0, -9, -Infinity) -> [1, 2, 3, 4, 5]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(-3, -2, -10),
+ [0n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(-3, -2, -10) -> [0, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-3, -2, -Infinity),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(-3, -2, -Infinity) -> [1, 2, 3, 4, 5]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(-7, -8, -9),
+ [0n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(-7, -8, -9) -> [0, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-7, -8, -Infinity),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(-7, -8, -Infinity) -> [1, 2, 3, 4, 5]'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js
new file mode 100644
index 000000000..06ec98f34
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js
@@ -0,0 +1,93 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Set values with out of bounds negative start argument.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 6. If relativeStart < 0, let from be max((len + relativeStart), 0); else let
+ from be min(relativeStart, len).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, -10),
+ [0n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3]).copyWithin(0, -10) -> [0, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, -Infinity),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5]).copyWithin(0, -Infinity) -> [1, 2, 3, 4, 5]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(2, -10),
+ [0n, 1n, 0n, 1n, 2n]
+ ),
+ '[0, 1, 2, 3, 4]).copyWithin(2, -2) -> [0, 1, 0, 1, 2]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(2, -Infinity),
+ [1n, 2n, 1n, 2n, 3n]
+ ),
+ '[1, 2, 3, 4, 5]).copyWithin(2, -Infinity) -> [1, 2, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(10, -10),
+ [0n, 1n, 2n, 3n, 4n]
+ ),
+ '[0, 1, 2, 3, 4]).copyWithin(10, -10) -> [0, 1, 2, 3, 4]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(10, -Infinity),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5]).copyWithin(10, -Infinity) -> [1, 2, 3, 4, 5]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(-9, -10),
+ [0n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(-9, -10) -> [0, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-9, -Infinity),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(-9, -Infinity) -> [1, 2, 3, 4, 5]'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js
new file mode 100644
index 000000000..91e2b0e5b
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js
@@ -0,0 +1,61 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Set values with out of bounds negative target argument.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 4. If relativeTarget < 0, let to be max((len + relativeTarget), 0); else let
+ to be min(relativeTarget, len).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(-10, 0),
+ [0n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(-10, 0) -> [0, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-Infinity, 0),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(-Infinity, 0) -> [1, 2, 3, 4, 5]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-10, 2),
+ [2n, 3n, 4n, 3n, 4n]
+ ),
+ '[0, 1, 2, 3, 4].copyWithin(-10, 2) -> [2, 3, 4, 3, 4]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(-Infinity, 2),
+ [3n, 4n, 5n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(-Infinity, 2) -> [3, 4, 5, 4, 5]'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js
new file mode 100644
index 000000000..36d5f2226
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js
@@ -0,0 +1,77 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Set values with negative start argument.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 6. If relativeStart < 0, let from be max((len + relativeStart), 0); else let
+ from be min(relativeStart, len).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, -1),
+ [3n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, -1) -> [3, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(2, -2),
+ [0n, 1n, 3n, 4n, 4n]
+ ),
+ '[0, 1, 2, 3, 4].copyWithin(2, -2) -> [0, 1, 3, 4, 4]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(1, -2),
+ [0n, 3n, 4n, 3n, 4n]
+ ),
+ '[0, 1, 2, 3, 4].copyWithin(1, -2) -> [0, 3, 4, 3, 4]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(-1, -2),
+ [0n, 1n, 2n, 2n]
+ ),
+ '[0, 1, 2, 3].copyWithin(-1, -2) -> [ 0, 1, 2, 2 ]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-2, -3),
+ [0n, 1n, 2n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3, 4].copyWithin(-2, -3) -> [0, 1, 2, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-5, -2),
+ [3n, 4n, 2n, 3n, 4n]
+ ),
+ '[0, 1, 2, 3, 4].copyWithin(-5, -2) -> [3, 4, 2, 3, 4]'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js
new file mode 100644
index 000000000..ec6adaedb
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js
@@ -0,0 +1,53 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Set values with negative target argument.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 4. If relativeTarget < 0, let to be max((len + relativeTarget), 0); else let
+ to be min(relativeTarget, len).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(-1, 0),
+ [0n, 1n, 2n, 0n]
+ ),
+ '[0, 1, 2, 3].copyWithin(-1, 0) -> [0, 1, 2, 0]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n]).copyWithin(-2, 2),
+ [0n, 1n, 2n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3, 4].copyWithin(-2, 2) -> [0, 1, 2, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(-1, 2),
+ [0n, 1n, 2n, 2n]
+ ),
+ '[0, 1, 2, 3].copyWithin(-1, 2) -> [0, 1, 2, 2]'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js
new file mode 100644
index 000000000..16d68d51b
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js
@@ -0,0 +1,54 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Max value of end position is the this.length.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, 6),
+ [1n, 2n, 3n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, 1, 6) -> [1, 2, 3, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, 1, Infinity),
+ [2n, 3n, 4n, 5n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(0, 1, Infinity) -> [2, 3, 4, 5, 5]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(1, 3, 6),
+ [0n, 3n, 4n, 5n, 4n, 5n]
+ ),
+ '[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 6) -> [0, 3, 4, 5, 4, 5]'
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(1, 3, Infinity),
+ [1n, 4n, 5n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(1, 3, Infinity) -> [1, 4, 5, 4, 5]'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js
new file mode 100644
index 000000000..fcb603491
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-target-and-start.js
@@ -0,0 +1,74 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Max values of target and start positions are this.length.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(6, 0),
+ [0n, 1n, 2n, 3n, 4n, 5n]
+ )
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(Infinity, 0),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(Infinity, 0) -> [1, 2, 3, 4, 5]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(0, 6),
+ [0n, 1n, 2n, 3n, 4n, 5n]
+ )
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(0, Infinity),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(0, Infinity) -> [1, 2, 3, 4, 5]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(6, 6),
+ [0n, 1n, 2n, 3n, 4n, 5n]
+ )
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(10, 10),
+ [0n, 1n, 2n, 3n, 4n, 5n]
+ )
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n]).copyWithin(Infinity, Infinity),
+ [1n, 2n, 3n, 4n, 5n]
+ ),
+ '[1, 2, 3, 4, 5].copyWithin(Infinity, Infinity) -> [1, 2, 3, 4, 5]'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js
new file mode 100644
index 000000000..27385c45e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Copy values with non-negative target and start positions.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n, 6n]).copyWithin(0, 0),
+ [1n, 2n, 3n, 4n, 5n, 6n]
+ )
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n, 6n]).copyWithin(0, 2),
+ [3n, 4n, 5n, 6n, 5n, 6n]
+ )
+ );
+
+ assert(
+ compareArray(
+ new TA([1n, 2n, 3n, 4n, 5n, 6n]).copyWithin(3, 0),
+ [1n, 2n, 3n, 1n, 2n, 3n]
+ )
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(1, 4),
+ [0n, 4n, 5n, 3n, 4n, 5n]
+ )
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js
new file mode 100644
index 000000000..befa6e752
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js
@@ -0,0 +1,73 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Copy values with non-negative target, start and end positions.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, 0, 0),
+ [0n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, 0, 0) -> [0, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, 0, 2),
+ [0n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, 0, 2) -> [0, 1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, 2),
+ [1n, 1n, 2n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, 1, 2) -> [1, 1, 2, 3]'
+ );
+
+ /*
+ * 10. If from<to and to<from+count, then
+ * a. Let direction be - 1.
+ * b. Let from be from + count - 1.
+ * c. Let to be to + count - 1.
+ *
+ * 0 < 1, 1 < 0 + 2
+ * direction = -1
+ * from = 0 + 2 - 1
+ * to = 1 + 2 - 1
+ */
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(1, 0, 2),
+ [0n, 0n, 1n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(1, 0, 2) -> [0, 0, 1, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n, 4n, 5n]).copyWithin(1, 3, 5),
+ [0n, 3n, 4n, 3n, 4n, 5n]
+ ),
+ '[0, 1, 2, 3, 4, 5].copyWithin(1, 3, 5) -> [0, 3, 4, 3, 4, 5]'
+ );
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js
new file mode 100644
index 000000000..d75e27ac0
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ "copyWithin" property of TypedArrayPrototype
+info: |
+ ES6 section 17: Every other data property described in clauses 18 through 26
+ and in Annex B.2 has the attributes { [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
+includes: [propertyHelper.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var TypedArrayPrototype = TypedArray.prototype;
+
+verifyNotEnumerable(TypedArrayPrototype, 'copyWithin');
+verifyWritable(TypedArrayPrototype, 'copyWithin');
+verifyConfigurable(TypedArrayPrototype, 'copyWithin');
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end-is-symbol.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end-is-symbol.js
new file mode 100644
index 000000000..cb06fdfda
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end-is-symbol.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Return abrupt if end is a Symbol.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 7. If end is undefined, let relativeEnd be len; else let relativeEnd be ?
+ ToInteger(end).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var s = Symbol(1);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+ assert.throws(TypeError, function() {
+ sample.copyWithin(0, 0, s);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end.js
new file mode 100644
index 000000000..6e7a39fb4
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Return abrupt from ToInteger(end).
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 7. If end is undefined, let relativeEnd be len; else let relativeEnd be ?
+ ToInteger(end).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var o1 = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+ };
+ var sample = new TA();
+ assert.throws(Test262Error, function() {
+ sample.copyWithin(0, 0, o1);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start-is-symbol.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start-is-symbol.js
new file mode 100644
index 000000000..d0b8b75f1
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start-is-symbol.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Return abrupt if start is a Symbol.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 5. Let relativeStart be ? ToInteger(start).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var s = Symbol(1);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+ assert.throws(TypeError, function() {
+ sample.copyWithin(0, s);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start.js
new file mode 100644
index 000000000..a8bb5d5b5
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Return abrupt from ToInteger(start).
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 5. Let relativeStart be ? ToInteger(start).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var o = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+var err = {
+ valueOf: function() {
+ throw new Error("ToInteger(start) runs before ToInteger(end)");
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+ assert.throws(Test262Error, function() {
+ sample.copyWithin(0, o, err);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target-is-symbol.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target-is-symbol.js
new file mode 100644
index 000000000..305e9234e
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target-is-symbol.js
@@ -0,0 +1,35 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Return abrupt if target is a Symbol.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 3. Let relativeTarget be ? ToInteger(target).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var s = Symbol(1);
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+ assert.throws(TypeError, function() {
+ sample.copyWithin(s, 0);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target.js
new file mode 100644
index 000000000..76d035b0a
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Return abrupt from ToInteger(target).
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 3. Let relativeTarget be ? ToInteger(target).
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var o = {
+ valueOf: function() {
+ throw new Test262Error();
+ }
+};
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample = new TA();
+ assert.throws(Test262Error, function() {
+ sample.copyWithin(o);
+ });
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js
new file mode 100644
index 000000000..2e5c40fa4
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Returns `this`.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ 13. Return O.
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ var sample1 = new TA();
+ var result1 = sample1.copyWithin(0, 0);
+
+ assert.sameValue(result1, sample1);
+
+ var sample2 = new TA([1n, 2n, 3n]);
+ var result2 = sample2.copyWithin(1, 0);
+
+ assert.sameValue(result2, sample2);
+});
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-object.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-object.js
new file mode 100644
index 000000000..3c1b7c435
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-object.js
@@ -0,0 +1,50 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: Throws a TypeError exception when `this` is not Object
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, Symbol, TypedArray]
+---*/
+
+var copyWithin = TypedArray.prototype.copyWithin;
+
+assert.throws(TypeError, function() {
+ copyWithin.call(undefined, 0, 0);
+}, "this is undefined");
+
+assert.throws(TypeError, function() {
+ copyWithin.call(null, 0, 0);
+}, "this is null");
+
+assert.throws(TypeError, function() {
+ copyWithin.call(42, 0, 0);
+}, "this is 42");
+
+assert.throws(TypeError, function() {
+ copyWithin.call("1", 0, 0);
+}, "this is a string");
+
+assert.throws(TypeError, function() {
+ copyWithin.call(true, 0, 0);
+}, "this is true");
+
+assert.throws(TypeError, function() {
+ copyWithin.call(false, 0, 0);
+}, "this is false");
+
+var s = Symbol("s");
+assert.throws(TypeError, function() {
+ copyWithin.call(s, 0, 0);
+}, "this is a Symbol");
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-typedarray-instance.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-typedarray-instance.js
new file mode 100644
index 000000000..95d9bfd12
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-typedarray-instance.js
@@ -0,0 +1,42 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ Throws a TypeError exception when `this` is not a TypedArray instance
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ This function is not generic. ValidateTypedArray is applied to the this value
+ prior to evaluating the algorithm. If its result is an abrupt completion that
+ exception is thrown instead of evaluating the algorithm.
+
+ 22.2.3.5.1 Runtime Semantics: ValidateTypedArray ( O )
+
+ 1. If Type(O) is not Object, throw a TypeError exception.
+ 2. If O does not have a [[TypedArrayName]] internal slot, throw a TypeError
+ exception.
+ ...
+includes: [testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+var copyWithin = TypedArray.prototype.copyWithin;
+
+assert.throws(TypeError, function() {
+ copyWithin.call({}, 0, 0);
+}, "this is an Object");
+
+assert.throws(TypeError, function() {
+ copyWithin.call([], 0, 0);
+}, "this is an Array");
+
+var ab = new ArrayBuffer(8);
+assert.throws(TypeError, function() {
+ copyWithin.call(ab, 0, 0);
+}, "this is an ArrayBuffer instance");
+
+var dv = new DataView(new ArrayBuffer(8), 0, 1);
+assert.throws(TypeError, function() {
+ copyWithin.call(dv, 0, 0);
+}, "this is a DataView instance");
diff --git a/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js
new file mode 100644
index 000000000..360d3125f
--- /dev/null
+++ b/test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js
@@ -0,0 +1,45 @@
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-%typedarray%.prototype.copywithin
+description: >
+ If `end` is undefined, set final position to `this.length`.
+info: |
+ 22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [ , end ] )
+
+ %TypedArray%.prototype.copyWithin is a distinct function that implements the
+ same algorithm as Array.prototype.copyWithin as defined in 22.1.3.3 except
+ that the this object's [[ArrayLength]] internal slot is accessed in place of
+ performing a [[Get]] of "length" and the actual copying of values in step 12
+ must be performed in a manner that preserves the bit-level encoding of the
+ source data.
+
+ ...
+
+ 22.1.3.3 Array.prototype.copyWithin (target, start [ , end ] )
+
+ ...
+ 7. If end is undefined, let relativeEnd be len; else let relativeEnd be ?
+ ToInteger(end).
+ ...
+includes: [compareArray.js, testBigIntTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+testWithBigIntTypedArrayConstructors(function(TA) {
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1, undefined),
+ [1n, 2n, 3n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, 1, undefined) -> [1, 2, 3]'
+ );
+
+ assert(
+ compareArray(
+ new TA([0n, 1n, 2n, 3n]).copyWithin(0, 1),
+ [1n, 2n, 3n, 3n]
+ ),
+ '[0, 1, 2, 3].copyWithin(0, 1) -> [1, 2, 3, 3]'
+ );
+});