mirror of
https://github.com/tc39/test262.git
synced 2025-07-26 15:34:29 +02:00
Merge pull request #1413 from leobalter/cxielarko-bigint-ta-3
BigInt+TypedArray tests, splitted
This commit is contained in:
commit
7024f3fa11
72
harness/testBigIntTypedArray.js
Normal file
72
harness/testBigIntTypedArray.js
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
description: |
|
||||||
|
Collection of functions used to assert the correctness of BigInt TypedArray objects.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array containing every typed array constructor.
|
||||||
|
*/
|
||||||
|
var BigIntTypedArrayConstructors = [
|
||||||
|
BigInt64Array,
|
||||||
|
BigUint64Array
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The %TypedArray% intrinsic constructor function.
|
||||||
|
*/
|
||||||
|
var TypedArray = Object.getPrototypeOf(Int8Array);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for testing a typed array constructor.
|
||||||
|
*
|
||||||
|
* @callback typedArrayConstructorCallback
|
||||||
|
* @param {Function} Constructor the constructor object to test with.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls the provided function for every typed array constructor.
|
||||||
|
*
|
||||||
|
* @param {typedArrayConstructorCallback} f - the function to call for each typed array constructor.
|
||||||
|
* @param {Array} selected - An optional Array with filtered typed arrays
|
||||||
|
*/
|
||||||
|
function testWithBigIntTypedArrayConstructors(f, selected) {
|
||||||
|
var constructors = selected || BigIntTypedArrayConstructors;
|
||||||
|
for (var i = 0; i < constructors.length; ++i) {
|
||||||
|
var constructor = constructors[i];
|
||||||
|
try {
|
||||||
|
f(constructor);
|
||||||
|
} catch (e) {
|
||||||
|
e.message += " (Testing with " + constructor.name + ".)";
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper for conversion operations on TypedArrays, the expected values
|
||||||
|
* properties are indexed in order to match the respective value for each
|
||||||
|
* TypedArray constructor
|
||||||
|
* @param {Function} fn - the function to call for each constructor and value.
|
||||||
|
* will be called with the constructor, value, expected
|
||||||
|
* value, and a initial value that can be used to avoid
|
||||||
|
* a false positive with an equivalent expected value.
|
||||||
|
*/
|
||||||
|
function testBigIntTypedArrayConversions(byteConversionValues, fn) {
|
||||||
|
var values = byteConversionValues.values;
|
||||||
|
var expected = byteConversionValues.expected;
|
||||||
|
|
||||||
|
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||||
|
var name = TA.name.slice(0, -5);
|
||||||
|
|
||||||
|
return values.forEach(function(value, index) {
|
||||||
|
var exp = expected[name][index];
|
||||||
|
var initial = 0;
|
||||||
|
if (exp === 0) {
|
||||||
|
initial = 1;
|
||||||
|
}
|
||||||
|
fn(TA, value, exp, initial);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
@ -21,6 +21,7 @@ info: |
|
|||||||
has the attributes { [[Writable]]: false, [[Enumerable]]: false,
|
has the attributes { [[Writable]]: false, [[Enumerable]]: false,
|
||||||
[[Configurable]]: true }.
|
[[Configurable]]: true }.
|
||||||
includes: [propertyHelper.js, testTypedArray.js]
|
includes: [propertyHelper.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert.sameValue(TypedArray.from.length, 1);
|
assert.sameValue(TypedArray.from.length, 1);
|
||||||
|
@ -17,6 +17,7 @@ info: |
|
|||||||
object, if it exists, has the attributes { [[Writable]]: false,
|
object, if it exists, has the attributes { [[Writable]]: false,
|
||||||
[[Enumerable]]: false, [[Configurable]]: true }.
|
[[Enumerable]]: false, [[Configurable]]: true }.
|
||||||
includes: [propertyHelper.js, testTypedArray.js]
|
includes: [propertyHelper.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert.sameValue(TypedArray.from.name, "from");
|
assert.sameValue(TypedArray.from.name, "from");
|
||||||
|
@ -9,6 +9,7 @@ info: |
|
|||||||
and in Annex B.2 has the attributes { [[Writable]]: true,
|
and in Annex B.2 has the attributes { [[Writable]]: true,
|
||||||
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
|
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
|
||||||
includes: [propertyHelper.js, testTypedArray.js]
|
includes: [propertyHelper.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
verifyNotEnumerable(TypedArray, 'from');
|
verifyNotEnumerable(TypedArray, 'from');
|
||||||
|
@ -14,6 +14,7 @@ info: |
|
|||||||
Function object has the attributes { [[Writable]]: false, [[Enumerable]]:
|
Function object has the attributes { [[Writable]]: false, [[Enumerable]]:
|
||||||
false, [[Configurable]]: true }.
|
false, [[Configurable]]: true }.
|
||||||
includes: [propertyHelper.js, testTypedArray.js]
|
includes: [propertyHelper.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert.sameValue(TypedArray.length, 0);
|
assert.sameValue(TypedArray.length, 0);
|
||||||
|
@ -15,6 +15,7 @@ info: |
|
|||||||
Function object, if it exists, has the attributes { [[Writable]]: false,
|
Function object, if it exists, has the attributes { [[Writable]]: false,
|
||||||
[[Enumerable]]: false, [[Configurable]]: true }.
|
[[Enumerable]]: false, [[Configurable]]: true }.
|
||||||
includes: [propertyHelper.js, testTypedArray.js]
|
includes: [propertyHelper.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert.sameValue(TypedArray.name, 'TypedArray');
|
assert.sameValue(TypedArray.name, 'TypedArray');
|
||||||
|
@ -21,6 +21,7 @@ info: |
|
|||||||
has the attributes { [[Writable]]: false, [[Enumerable]]: false,
|
has the attributes { [[Writable]]: false, [[Enumerable]]: false,
|
||||||
[[Configurable]]: true }.
|
[[Configurable]]: true }.
|
||||||
includes: [propertyHelper.js, testTypedArray.js]
|
includes: [propertyHelper.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert.sameValue(TypedArray.of.length, 0);
|
assert.sameValue(TypedArray.of.length, 0);
|
||||||
|
@ -17,6 +17,7 @@ info: |
|
|||||||
object, if it exists, has the attributes { [[Writable]]: false,
|
object, if it exists, has the attributes { [[Writable]]: false,
|
||||||
[[Enumerable]]: false, [[Configurable]]: true }.
|
[[Enumerable]]: false, [[Configurable]]: true }.
|
||||||
includes: [propertyHelper.js, testTypedArray.js]
|
includes: [propertyHelper.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert.sameValue(TypedArray.of.name, "of");
|
assert.sameValue(TypedArray.of.name, "of");
|
||||||
|
@ -9,6 +9,7 @@ info: |
|
|||||||
and in Annex B.2 has the attributes { [[Writable]]: true,
|
and in Annex B.2 has the attributes { [[Writable]]: true,
|
||||||
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
|
[[Enumerable]]: false, [[Configurable]]: true } unless otherwise specified.
|
||||||
includes: [propertyHelper.js, testTypedArray.js]
|
includes: [propertyHelper.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
verifyNotEnumerable(TypedArray, 'of');
|
verifyNotEnumerable(TypedArray, 'of');
|
||||||
|
1
test/built-ins/TypedArray/prototype.js
vendored
1
test/built-ins/TypedArray/prototype.js
vendored
@ -10,6 +10,7 @@ info: |
|
|||||||
This property has the attributes { [[Writable]]: false, [[Enumerable]]:
|
This property has the attributes { [[Writable]]: false, [[Enumerable]]:
|
||||||
false, [[Configurable]]: false }.
|
false, [[Configurable]]: false }.
|
||||||
includes: [propertyHelper.js, testTypedArray.js]
|
includes: [propertyHelper.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
verifyNotEnumerable(TypedArray, 'prototype');
|
verifyNotEnumerable(TypedArray, 'prototype');
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.30
|
esid: sec-%typedarray%.prototype-@@iterator
|
||||||
description: >
|
description: >
|
||||||
Initial state of the Symbol.iterator property
|
Initial state of the Symbol.iterator property
|
||||||
info: |
|
info: |
|
||||||
|
21
test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/detached-buffer.js
vendored
Normal file
21
test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/detached-buffer.js
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// 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-get-%typedarray%.prototype-@@tostringtag
|
||||||
|
description: The getter method does not throw with a detached buffer
|
||||||
|
info: |
|
||||||
|
22.2.3.32 get %TypedArray%.prototype [ @@toStringTag ]
|
||||||
|
|
||||||
|
...
|
||||||
|
4. Let name be the value of O's [[TypedArrayName]] internal slot.
|
||||||
|
5. Assert: name is a String value.
|
||||||
|
6. Return name.
|
||||||
|
includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
|
||||||
|
features: [BigInt, Symbol.toStringTag, TypedArray]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||||
|
var sample = new TA(1);
|
||||||
|
$DETACHBUFFER(sample.buffer);
|
||||||
|
assert.sameValue(sample[Symbol.toStringTag], TA.name);
|
||||||
|
});
|
20
test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-accessor.js
vendored
Normal file
20
test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-accessor.js
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// 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-get-%typedarray%.prototype-@@tostringtag
|
||||||
|
description: >
|
||||||
|
Return undefined if this value does not have a [[TypedArrayName]] internal slot
|
||||||
|
info: |
|
||||||
|
22.2.3.31 get %TypedArray%.prototype [ @@toStringTag ]
|
||||||
|
|
||||||
|
1. Let O be the this value.
|
||||||
|
...
|
||||||
|
3. If O does not have a [[TypedArrayName]] internal slot, return undefined.
|
||||||
|
...
|
||||||
|
includes: [testBigIntTypedArray.js]
|
||||||
|
features: [BigInt, Symbol.toStringTag, TypedArray]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var TypedArrayPrototype = TypedArray.prototype;
|
||||||
|
|
||||||
|
assert.sameValue(TypedArrayPrototype[Symbol.toStringTag], undefined);
|
21
test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-func.js
vendored
Normal file
21
test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/invoked-as-func.js
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// 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-get-%typedarray%.prototype-@@tostringtag
|
||||||
|
description: If this value is not Object, return undefined.
|
||||||
|
info: |
|
||||||
|
22.2.3.31 get %TypedArray%.prototype [ @@toStringTag ]
|
||||||
|
|
||||||
|
1. Let O be the this value.
|
||||||
|
2. If Type(O) is not Object, return undefined.
|
||||||
|
...
|
||||||
|
includes: [testBigIntTypedArray.js]
|
||||||
|
features: [BigInt, Symbol.toStringTag, TypedArray]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var TypedArrayPrototype = TypedArray.prototype;
|
||||||
|
var getter = Object.getOwnPropertyDescriptor(
|
||||||
|
TypedArrayPrototype, Symbol.toStringTag
|
||||||
|
).get;
|
||||||
|
|
||||||
|
assert.sameValue(getter(), undefined);
|
32
test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/length.js
vendored
Normal file
32
test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/length.js
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-get-%typedarray%.prototype-@@tostringtag
|
||||||
|
description: >
|
||||||
|
get %TypedArray%.prototype [ @@toStringTag ].length is 0.
|
||||||
|
info: |
|
||||||
|
get %TypedArray%.prototype [ @@toStringTag ]
|
||||||
|
|
||||||
|
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, Symbol.toStringTag]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, Symbol.toStringTag);
|
||||||
|
|
||||||
|
assert.sameValue(desc.get.length, 0);
|
||||||
|
|
||||||
|
verifyNotEnumerable(desc.get, "length");
|
||||||
|
verifyNotWritable(desc.get, "length");
|
||||||
|
verifyConfigurable(desc.get, "length");
|
29
test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/name.js
vendored
Normal file
29
test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/name.js
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// Copyright (C) 2015 André Bargull. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-get-%typedarray%.prototype-@@tostringtag
|
||||||
|
description: >
|
||||||
|
get %TypedArray%.prototype [ @@toStringTag ].name is "get [Symbol.toStringTag]".
|
||||||
|
info: |
|
||||||
|
get %TypedArray%.prototype [ @@toStringTag ]
|
||||||
|
|
||||||
|
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, Symbol.toStringTag]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, Symbol.toStringTag);
|
||||||
|
|
||||||
|
assert.sameValue(desc.get.name, "get [Symbol.toStringTag]");
|
||||||
|
|
||||||
|
verifyNotEnumerable(desc.get, "name");
|
||||||
|
verifyNotWritable(desc.get, "name");
|
||||||
|
verifyConfigurable(desc.get, "name");
|
28
test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/prop-desc.js
vendored
Normal file
28
test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/prop-desc.js
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// 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-get-%typedarray%.prototype-@@tostringtag
|
||||||
|
description: >
|
||||||
|
"@@toStringTag" property of TypedArrayPrototype
|
||||||
|
info: |
|
||||||
|
22.2.3.31 get %TypedArray%.prototype [ @@toStringTag ]
|
||||||
|
|
||||||
|
%TypedArray%.prototype[@@toStringTag] is an accessor property whose set
|
||||||
|
accessor function is undefined.
|
||||||
|
...
|
||||||
|
|
||||||
|
This property has the attributes { [[Enumerable]]: false, [[Configurable]]:
|
||||||
|
true }.
|
||||||
|
includes: [propertyHelper.js, testBigIntTypedArray.js]
|
||||||
|
features: [BigInt, Symbol.toStringTag]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var TypedArrayPrototype = TypedArray.prototype;
|
||||||
|
var desc = Object.getOwnPropertyDescriptor(
|
||||||
|
TypedArrayPrototype, Symbol.toStringTag
|
||||||
|
);
|
||||||
|
|
||||||
|
assert.sameValue(desc.set, undefined);
|
||||||
|
assert.sameValue(typeof desc.get, 'function');
|
||||||
|
verifyNotEnumerable(TypedArrayPrototype, Symbol.toStringTag);
|
||||||
|
verifyConfigurable(TypedArrayPrototype, Symbol.toStringTag);
|
21
test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/return-typedarrayname.js
vendored
Normal file
21
test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/return-typedarrayname.js
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// 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-get-%typedarray%.prototype-@@tostringtag
|
||||||
|
description: >
|
||||||
|
Return value from the [[TypedArrayName]] internal slot
|
||||||
|
info: |
|
||||||
|
22.2.3.32 get %TypedArray%.prototype [ @@toStringTag ]
|
||||||
|
|
||||||
|
...
|
||||||
|
4. Let name be the value of O's [[TypedArrayName]] internal slot.
|
||||||
|
5. Assert: name is a String value.
|
||||||
|
6. Return name.
|
||||||
|
includes: [testBigIntTypedArray.js]
|
||||||
|
features: [BigInt, Symbol.toStringTag, TypedArray]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||||
|
var ta = new TA();
|
||||||
|
assert.sameValue(ta[Symbol.toStringTag], TA.name, "property value");
|
||||||
|
});
|
@ -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-get-%typedarray%.prototype-@@tostringtag
|
||||||
|
description: >
|
||||||
|
Return undefined when `this` does not have a [[TypedArrayName]] internal slot
|
||||||
|
info: |
|
||||||
|
22.2.3.32 get %TypedArray%.prototype [ @@toStringTag ]
|
||||||
|
|
||||||
|
1. Let O be the this value.
|
||||||
|
...
|
||||||
|
3. If O does not have a [[TypedArrayName]] internal slot, return undefined.
|
||||||
|
...
|
||||||
|
includes: [testBigIntTypedArray.js]
|
||||||
|
features: [BigInt, Symbol.toStringTag, DataView, TypedArray]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var TypedArrayPrototype = TypedArray.prototype;
|
||||||
|
var getter = Object.getOwnPropertyDescriptor(
|
||||||
|
TypedArrayPrototype, Symbol.toStringTag
|
||||||
|
).get;
|
||||||
|
|
||||||
|
assert.sameValue(getter.call({}), undefined);
|
||||||
|
assert.sameValue(getter.call([]), undefined);
|
||||||
|
assert.sameValue(getter.call(new ArrayBuffer(8)), undefined);
|
||||||
|
|
||||||
|
var ab = new ArrayBuffer(8);
|
||||||
|
var dv = new DataView(ab, 0, 1);
|
||||||
|
assert.sameValue(getter.call(dv), undefined);
|
27
test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-is-not-object.js
vendored
Normal file
27
test/built-ins/TypedArray/prototype/Symbol.toStringTag/BigInt/this-is-not-object.js
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// 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-get-%typedarray%.prototype-@@tostringtag
|
||||||
|
description: Return undefined when `this` is not Object
|
||||||
|
info: |
|
||||||
|
22.2.3.32 get %TypedArray%.prototype [ @@toStringTag ]
|
||||||
|
|
||||||
|
1. Let O be the this value.
|
||||||
|
2. If Type(O) is not Object, return undefined.
|
||||||
|
...
|
||||||
|
includes: [testBigIntTypedArray.js]
|
||||||
|
features: [BigInt, Symbol, Symbol.toStringTag, TypedArray]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var TypedArrayPrototype = TypedArray.prototype;
|
||||||
|
var getter = Object.getOwnPropertyDescriptor(
|
||||||
|
TypedArrayPrototype, Symbol.toStringTag
|
||||||
|
).get;
|
||||||
|
|
||||||
|
assert.sameValue(getter.call(undefined), undefined, "this is undefined");
|
||||||
|
assert.sameValue(getter.call(42), undefined, "this is 42");
|
||||||
|
assert.sameValue(getter.call("foo"), undefined, "this is a string");
|
||||||
|
assert.sameValue(getter.call(true), undefined, "this is true");
|
||||||
|
assert.sameValue(getter.call(false), undefined, "this is false");
|
||||||
|
assert.sameValue(getter.call(Symbol("s")), undefined, "this is a Symbol");
|
||||||
|
assert.sameValue(getter.call(null), undefined, "this is null");
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.31
|
esid: sec-get-%typedarray%.prototype-@@tostringtag
|
||||||
description: >
|
description: >
|
||||||
Return undefined if this value does not have a [[TypedArrayName]] internal slot
|
Return undefined if this value does not have a [[TypedArrayName]] internal slot
|
||||||
info: |
|
info: |
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.31
|
esid: sec-get-%typedarray%.prototype-@@tostringtag
|
||||||
description: If this value is not Object, return undefined.
|
description: If this value is not Object, return undefined.
|
||||||
info: |
|
info: |
|
||||||
22.2.3.31 get %TypedArray%.prototype [ @@toStringTag ]
|
22.2.3.31 get %TypedArray%.prototype [ @@toStringTag ]
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.31
|
esid: sec-get-%typedarray%.prototype-@@tostringtag
|
||||||
description: >
|
description: >
|
||||||
get %TypedArray%.prototype [ @@toStringTag ].length is 0.
|
get %TypedArray%.prototype [ @@toStringTag ].length is 0.
|
||||||
info: |
|
info: |
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.31
|
esid: sec-get-%typedarray%.prototype-@@tostringtag
|
||||||
description: >
|
description: >
|
||||||
get %TypedArray%.prototype [ @@toStringTag ].name is "get [Symbol.toStringTag]".
|
get %TypedArray%.prototype [ @@toStringTag ].name is "get [Symbol.toStringTag]".
|
||||||
info: |
|
info: |
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.31
|
esid: sec-get-%typedarray%.prototype-@@tostringtag
|
||||||
description: >
|
description: >
|
||||||
"@@toStringTag" property of TypedArrayPrototype
|
"@@toStringTag" property of TypedArrayPrototype
|
||||||
info: |
|
info: |
|
||||||
|
21
test/built-ins/TypedArray/prototype/buffer/BigInt/detached-buffer.js
vendored
Normal file
21
test/built-ins/TypedArray/prototype/buffer/BigInt/detached-buffer.js
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// 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-get-%typedarray%.prototype.buffer
|
||||||
|
description: The getter method does not throw with a detached buffer
|
||||||
|
info: |
|
||||||
|
22.2.3.1 get %TypedArray%.prototype.buffer
|
||||||
|
|
||||||
|
...
|
||||||
|
4. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot.
|
||||||
|
5. Return buffer.
|
||||||
|
includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
|
||||||
|
features: [BigInt, TypedArray]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||||
|
var buffer = new ArrayBuffer(8);
|
||||||
|
var sample = new TA(buffer, 0, 1);
|
||||||
|
$DETACHBUFFER(sample.buffer);
|
||||||
|
assert.sameValue(sample.buffer, buffer);
|
||||||
|
}, [BigInt64Array, BigUint64Array]);
|
22
test/built-ins/TypedArray/prototype/buffer/BigInt/return-buffer.js
vendored
Normal file
22
test/built-ins/TypedArray/prototype/buffer/BigInt/return-buffer.js
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// 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-get-%typedarray%.prototype.buffer
|
||||||
|
description: >
|
||||||
|
Return buffer from [[ViewedArrayBuffer]] internal slot
|
||||||
|
info: |
|
||||||
|
22.2.3.1 get %TypedArray%.prototype.buffer
|
||||||
|
|
||||||
|
...
|
||||||
|
4. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot.
|
||||||
|
5. Return buffer.
|
||||||
|
includes: [testBigIntTypedArray.js]
|
||||||
|
features: [BigInt, TypedArray]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||||
|
var buffer = new ArrayBuffer(TA.BYTES_PER_ELEMENT);
|
||||||
|
var ta = new TA(buffer);
|
||||||
|
|
||||||
|
assert.sameValue(ta.buffer, buffer);
|
||||||
|
}, [BigInt64Array, BigUint64Array]);
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.1
|
esid: sec-get-%typedarray%.prototype.buffer
|
||||||
description: >
|
description: >
|
||||||
Requires this value to have a [[ViewedArrayBuffer]] internal slot
|
Requires this value to have a [[ViewedArrayBuffer]] internal slot
|
||||||
info: |
|
info: |
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.1
|
esid: sec-get-%typedarray%.prototype.buffer
|
||||||
description: Throws a TypeError exception when invoked as a function
|
description: Throws a TypeError exception when invoked as a function
|
||||||
info: |
|
info: |
|
||||||
22.2.3.1 get %TypedArray%.prototype.buffer
|
22.2.3.1 get %TypedArray%.prototype.buffer
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.1
|
esid: sec-get-%typedarray%.prototype.buffer
|
||||||
description: >
|
description: >
|
||||||
get %TypedArray%.prototype.buffer.length is 0.
|
get %TypedArray%.prototype.buffer.length is 0.
|
||||||
info: |
|
info: |
|
||||||
@ -20,6 +20,7 @@ info: |
|
|||||||
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
|
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
|
||||||
[[Configurable]]: true }.
|
[[Configurable]]: true }.
|
||||||
includes: [propertyHelper.js, testTypedArray.js]
|
includes: [propertyHelper.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "buffer");
|
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "buffer");
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.1
|
esid: sec-get-%typedarray%.prototype.buffer
|
||||||
description: >
|
description: >
|
||||||
get %TypedArray%.prototype.buffer.name is "get buffer".
|
get %TypedArray%.prototype.buffer.name is "get buffer".
|
||||||
info: |
|
info: |
|
||||||
@ -17,6 +17,7 @@ info: |
|
|||||||
object, if it exists, has the attributes { [[Writable]]: false,
|
object, if it exists, has the attributes { [[Writable]]: false,
|
||||||
[[Enumerable]]: false, [[Configurable]]: true }.
|
[[Enumerable]]: false, [[Configurable]]: true }.
|
||||||
includes: [propertyHelper.js, testTypedArray.js]
|
includes: [propertyHelper.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "buffer");
|
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "buffer");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.1
|
esid: sec-get-%typedarray%.prototype.buffer
|
||||||
description: >
|
description: >
|
||||||
"buffer" property of TypedArrayPrototype
|
"buffer" property of TypedArrayPrototype
|
||||||
info: |
|
info: |
|
||||||
@ -11,6 +11,7 @@ info: |
|
|||||||
Section 17: Every accessor property described in clauses 18 through 26 and in
|
Section 17: Every accessor property described in clauses 18 through 26 and in
|
||||||
Annex B.2 has the attributes {[[Enumerable]]: false, [[Configurable]]: true }
|
Annex B.2 has the attributes {[[Enumerable]]: false, [[Configurable]]: true }
|
||||||
includes: [propertyHelper.js, testTypedArray.js]
|
includes: [propertyHelper.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var TypedArrayPrototype = TypedArray.prototype;
|
var TypedArrayPrototype = TypedArray.prototype;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.1
|
esid: sec-get-%typedarray%.prototype.buffer
|
||||||
description: >
|
description: >
|
||||||
Return buffer from [[ViewedArrayBuffer]] internal slot
|
Return buffer from [[ViewedArrayBuffer]] internal slot
|
||||||
info: |
|
info: |
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
esid: sec-get-%typedarray%.prototype.buffer
|
esid: sec-get-%typedarray%.prototype.buffer
|
||||||
es6id: 22.2.3.1
|
|
||||||
description: >
|
description: >
|
||||||
Throws a TypeError exception when `this` does not have a [[TypedArrayName]]
|
Throws a TypeError exception when `this` does not have a [[TypedArrayName]]
|
||||||
internal slot
|
internal slot
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.1
|
esid: sec-get-%typedarray%.prototype.buffer
|
||||||
description: Throws a TypeError exception when `this` is not Object
|
description: Throws a TypeError exception when `this` is not Object
|
||||||
info: |
|
info: |
|
||||||
22.2.3.1 get %TypedArray%.prototype.buffer
|
22.2.3.1 get %TypedArray%.prototype.buffer
|
||||||
|
21
test/built-ins/TypedArray/prototype/byteLength/BigInt/detached-buffer.js
vendored
Normal file
21
test/built-ins/TypedArray/prototype/byteLength/BigInt/detached-buffer.js
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// 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-get-%typedarray%.prototype.bytelength
|
||||||
|
description: Returns 0 if the instance has a detached buffer
|
||||||
|
info: |
|
||||||
|
22.2.3.2 get %TypedArray%.prototype.byteLength
|
||||||
|
|
||||||
|
...
|
||||||
|
4. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot.
|
||||||
|
5. If IsDetachedBuffer(buffer) is true, return 0.
|
||||||
|
...
|
||||||
|
includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
|
||||||
|
features: [BigInt, TypedArray]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||||
|
var sample = new TA(1);
|
||||||
|
$DETACHBUFFER(sample.buffer);
|
||||||
|
assert.sameValue(sample.byteLength, 0);
|
||||||
|
});
|
24
test/built-ins/TypedArray/prototype/byteLength/BigInt/return-bytelength.js
vendored
Normal file
24
test/built-ins/TypedArray/prototype/byteLength/BigInt/return-bytelength.js
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// 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-get-%typedarray%.prototype.bytelength
|
||||||
|
description: >
|
||||||
|
Return value from [[ByteLength]] internal slot
|
||||||
|
info: |
|
||||||
|
22.2.3.2 get %TypedArray%.prototype.byteLength
|
||||||
|
|
||||||
|
...
|
||||||
|
6. Let size be the value of O's [[ByteLength]] internal slot.
|
||||||
|
7. Return size.
|
||||||
|
includes: [testBigIntTypedArray.js]
|
||||||
|
features: [BigInt, TypedArray]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||||
|
var bytesPerElement = TA.BYTES_PER_ELEMENT;
|
||||||
|
var ta1 = new TA();
|
||||||
|
assert.sameValue(ta1.byteLength, 0);
|
||||||
|
|
||||||
|
var ta2 = new TA(42);
|
||||||
|
assert.sameValue(ta2.byteLength, 42 * bytesPerElement);
|
||||||
|
});
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.2
|
esid: sec-get-%typedarray%.prototype.bytelength
|
||||||
description: >
|
description: >
|
||||||
Requires this value to have a [[ViewedArrayBuffer]] internal slot
|
Requires this value to have a [[ViewedArrayBuffer]] internal slot
|
||||||
info: |
|
info: |
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.2
|
esid: sec-get-%typedarray%.prototype.bytelength
|
||||||
description: Throws a TypeError exception when invoked as a function
|
description: Throws a TypeError exception when invoked as a function
|
||||||
info: |
|
info: |
|
||||||
22.2.3.2 get %TypedArray%.prototype.byteLength
|
22.2.3.2 get %TypedArray%.prototype.byteLength
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.2
|
esid: sec-get-%typedarray%.prototype.bytelength
|
||||||
description: >
|
description: >
|
||||||
get %TypedArray%.prototype.byteLength.length is 0.
|
get %TypedArray%.prototype.byteLength.length is 0.
|
||||||
info: |
|
info: |
|
||||||
@ -20,6 +20,7 @@ info: |
|
|||||||
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
|
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
|
||||||
[[Configurable]]: true }.
|
[[Configurable]]: true }.
|
||||||
includes: [propertyHelper.js, testTypedArray.js]
|
includes: [propertyHelper.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "byteLength");
|
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "byteLength");
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.2
|
esid: sec-get-%typedarray%.prototype.bytelength
|
||||||
description: >
|
description: >
|
||||||
get %TypedArray%.prototype.byteLength.name is "get byteLength".
|
get %TypedArray%.prototype.byteLength.name is "get byteLength".
|
||||||
info: |
|
info: |
|
||||||
@ -17,6 +17,7 @@ info: |
|
|||||||
object, if it exists, has the attributes { [[Writable]]: false,
|
object, if it exists, has the attributes { [[Writable]]: false,
|
||||||
[[Enumerable]]: false, [[Configurable]]: true }.
|
[[Enumerable]]: false, [[Configurable]]: true }.
|
||||||
includes: [propertyHelper.js, testTypedArray.js]
|
includes: [propertyHelper.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "byteLength");
|
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "byteLength");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.2
|
esid: sec-get-%typedarray%.prototype.bytelength
|
||||||
description: >
|
description: >
|
||||||
"byteLength" property of TypedArrayPrototype
|
"byteLength" property of TypedArrayPrototype
|
||||||
info: |
|
info: |
|
||||||
@ -11,6 +11,7 @@ info: |
|
|||||||
Section 17: Every accessor property described in clauses 18 through 26 and in
|
Section 17: Every accessor property described in clauses 18 through 26 and in
|
||||||
Annex B.2 has the attributes {[[Enumerable]]: false, [[Configurable]]: true }
|
Annex B.2 has the attributes {[[Enumerable]]: false, [[Configurable]]: true }
|
||||||
includes: [propertyHelper.js, testTypedArray.js]
|
includes: [propertyHelper.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var TypedArrayPrototype = TypedArray.prototype;
|
var TypedArrayPrototype = TypedArray.prototype;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.2
|
esid: sec-get-%typedarray%.prototype.bytelength
|
||||||
description: >
|
description: >
|
||||||
Return value from [[ByteLength]] internal slot
|
Return value from [[ByteLength]] internal slot
|
||||||
info: |
|
info: |
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
esid: sec-get-%typedarray%.prototype.bytelength
|
esid: sec-get-%typedarray%.prototype.bytelength
|
||||||
es6id: 22.2.3.2
|
|
||||||
description: >
|
description: >
|
||||||
Throws a TypeError exception when `this` does not have a [[TypedArrayName]]
|
Throws a TypeError exception when `this` does not have a [[TypedArrayName]]
|
||||||
internal slot
|
internal slot
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.2
|
esid: sec-get-%typedarray%.prototype.bytelength
|
||||||
description: Throws a TypeError exception when `this` is not Object
|
description: Throws a TypeError exception when `this` is not Object
|
||||||
info: |
|
info: |
|
||||||
22.2.3.2 get %TypedArray%.prototype.byteLength
|
22.2.3.2 get %TypedArray%.prototype.byteLength
|
||||||
|
22
test/built-ins/TypedArray/prototype/byteOffset/BigInt/detached-buffer.js
vendored
Normal file
22
test/built-ins/TypedArray/prototype/byteOffset/BigInt/detached-buffer.js
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// 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-get-%typedarray%.prototype.byteoffset
|
||||||
|
description: Returns 0 if the instance has a detached buffer
|
||||||
|
info: |
|
||||||
|
22.2.3.3 get %TypedArray%.prototype.byteOffset
|
||||||
|
|
||||||
|
...
|
||||||
|
4. Let buffer be the value of O's [[ViewedArrayBuffer]] internal slot.
|
||||||
|
5. If IsDetachedBuffer(buffer) is true, return 0.
|
||||||
|
...
|
||||||
|
includes: [testBigIntTypedArray.js, detachArrayBuffer.js]
|
||||||
|
features: [BigInt, TypedArray]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||||
|
var buffer = new ArrayBuffer(128);
|
||||||
|
var sample = new TA(buffer, 8, 1);
|
||||||
|
$DETACHBUFFER(sample.buffer);
|
||||||
|
assert.sameValue(sample.byteOffset, 0);
|
||||||
|
});
|
31
test/built-ins/TypedArray/prototype/byteOffset/BigInt/return-byteoffset.js
vendored
Normal file
31
test/built-ins/TypedArray/prototype/byteOffset/BigInt/return-byteoffset.js
vendored
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// 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-get-%typedarray%.prototype.byteoffset
|
||||||
|
description: >
|
||||||
|
Return value from [[ByteOffset]] internal slot
|
||||||
|
info: |
|
||||||
|
22.2.3.3 get %TypedArray%.prototype.byteOffset
|
||||||
|
|
||||||
|
...
|
||||||
|
6. Let offset be the value of O's [[ByteOffset]] internal slot.
|
||||||
|
7. Return size.
|
||||||
|
includes: [testBigIntTypedArray.js]
|
||||||
|
features: [BigInt, TypedArray]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
testWithBigIntTypedArrayConstructors(function(TA) {
|
||||||
|
var ta1 = new TA();
|
||||||
|
assert.sameValue(ta1.byteOffset, 0, "Regular typedArray");
|
||||||
|
|
||||||
|
var offset = 4 * TA.BYTES_PER_ELEMENT;
|
||||||
|
|
||||||
|
var buffer1 = new ArrayBuffer(8 * TA.BYTES_PER_ELEMENT);
|
||||||
|
var ta2 = new TA(buffer1, offset);
|
||||||
|
assert.sameValue(ta2.byteOffset, offset, "TA(buffer, offset)");
|
||||||
|
|
||||||
|
var buffer2 = new ArrayBuffer(8 * TA.BYTES_PER_ELEMENT);
|
||||||
|
var sample = new TA(buffer2, offset);
|
||||||
|
var ta3 = new TA(sample);
|
||||||
|
assert.sameValue(ta3.byteOffset, 0, "TA(typedArray)");
|
||||||
|
});
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.3
|
esid: sec-get-%typedarray%.prototype.byteoffset
|
||||||
description: >
|
description: >
|
||||||
Requires this value to have a [[ViewedArrayBuffer]] internal slot
|
Requires this value to have a [[ViewedArrayBuffer]] internal slot
|
||||||
info: |
|
info: |
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.3
|
esid: sec-get-%typedarray%.prototype.byteoffset
|
||||||
description: Throws a TypeError exception when invoked as a function
|
description: Throws a TypeError exception when invoked as a function
|
||||||
info: |
|
info: |
|
||||||
22.2.3.3 get %TypedArray%.prototype.byteOffset
|
22.2.3.3 get %TypedArray%.prototype.byteOffset
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.3
|
esid: sec-get-%typedarray%.prototype.byteoffset
|
||||||
description: >
|
description: >
|
||||||
get %TypedArray%.prototype.byteOffset.length is 0.
|
get %TypedArray%.prototype.byteOffset.length is 0.
|
||||||
info: |
|
info: |
|
||||||
@ -20,6 +20,7 @@ info: |
|
|||||||
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
|
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
|
||||||
[[Configurable]]: true }.
|
[[Configurable]]: true }.
|
||||||
includes: [propertyHelper.js, testTypedArray.js]
|
includes: [propertyHelper.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "byteOffset");
|
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "byteOffset");
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.3
|
esid: sec-get-%typedarray%.prototype.byteoffset
|
||||||
description: >
|
description: >
|
||||||
get %TypedArray%.prototype.byteOffset.name is "get byteOffset".
|
get %TypedArray%.prototype.byteOffset.name is "get byteOffset".
|
||||||
info: |
|
info: |
|
||||||
@ -17,6 +17,7 @@ info: |
|
|||||||
object, if it exists, has the attributes { [[Writable]]: false,
|
object, if it exists, has the attributes { [[Writable]]: false,
|
||||||
[[Enumerable]]: false, [[Configurable]]: true }.
|
[[Enumerable]]: false, [[Configurable]]: true }.
|
||||||
includes: [propertyHelper.js, testTypedArray.js]
|
includes: [propertyHelper.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "byteOffset");
|
var desc = Object.getOwnPropertyDescriptor(TypedArray.prototype, "byteOffset");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.3
|
esid: sec-get-%typedarray%.prototype.byteoffset
|
||||||
description: >
|
description: >
|
||||||
"byteOffset" property of TypedArrayPrototype
|
"byteOffset" property of TypedArrayPrototype
|
||||||
info: |
|
info: |
|
||||||
@ -11,6 +11,7 @@ info: |
|
|||||||
Section 17: Every accessor property described in clauses 18 through 26 and in
|
Section 17: Every accessor property described in clauses 18 through 26 and in
|
||||||
Annex B.2 has the attributes {[[Enumerable]]: false, [[Configurable]]: true }
|
Annex B.2 has the attributes {[[Enumerable]]: false, [[Configurable]]: true }
|
||||||
includes: [propertyHelper.js, testTypedArray.js]
|
includes: [propertyHelper.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var TypedArrayPrototype = TypedArray.prototype;
|
var TypedArrayPrototype = TypedArray.prototype;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.3
|
esid: sec-get-%typedarray%.prototype.byteoffset
|
||||||
description: >
|
description: >
|
||||||
Return value from [[ByteOffset]] internal slot
|
Return value from [[ByteOffset]] internal slot
|
||||||
info: |
|
info: |
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
esid: sec-get-%typedarray%.prototype.byteoffset
|
esid: sec-get-%typedarray%.prototype.byteoffset
|
||||||
es6id: 22.2.3.3
|
|
||||||
description: >
|
description: >
|
||||||
Throws a TypeError exception when `this` does not have a [[TypedArrayName]]
|
Throws a TypeError exception when `this` does not have a [[TypedArrayName]]
|
||||||
internal slot
|
internal slot
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.3
|
esid: sec-get-%typedarray%.prototype.byteoffset
|
||||||
description: Throws a TypeError exception when `this` is not Object
|
description: Throws a TypeError exception when `this` is not Object
|
||||||
info: |
|
info: |
|
||||||
22.2.3.3 get %TypedArray%.prototype.byteOffset
|
22.2.3.3 get %TypedArray%.prototype.byteOffset
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.4
|
esid: sec-%typedarray%.prototype.constructor
|
||||||
description: >
|
description: >
|
||||||
Initial state of the constructor property
|
Initial state of the constructor property
|
||||||
info: |
|
info: |
|
||||||
@ -11,6 +11,7 @@ info: |
|
|||||||
Per ES6 section 17, the method should exist on the %TypedArray% prototype, and it
|
Per ES6 section 17, the method should exist on the %TypedArray% prototype, and it
|
||||||
should be writable and configurable, but not enumerable.
|
should be writable and configurable, but not enumerable.
|
||||||
includes: [propertyHelper.js, testTypedArray.js]
|
includes: [propertyHelper.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert.sameValue(TypedArray.prototype.constructor, TypedArray);
|
assert.sameValue(TypedArray.prototype.constructor, TypedArray);
|
||||||
|
77
test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js
vendored
Normal file
77
test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-end.js
vendored
Normal file
@ -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'
|
||||||
|
);
|
||||||
|
});
|
92
test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js
vendored
Normal file
92
test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-start.js
vendored
Normal file
@ -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'
|
||||||
|
);
|
||||||
|
});
|
92
test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js
vendored
Normal file
92
test/built-ins/TypedArray/prototype/copyWithin/BigInt/coerced-values-target.js
vendored
Normal file
@ -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'
|
||||||
|
);
|
||||||
|
});
|
34
test/built-ins/TypedArray/prototype/copyWithin/BigInt/detached-buffer.js
vendored
Normal file
34
test/built-ins/TypedArray/prototype/copyWithin/BigInt/detached-buffer.js
vendored
Normal file
@ -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);
|
||||||
|
});
|
||||||
|
});
|
49
test/built-ins/TypedArray/prototype/copyWithin/BigInt/get-length-ignores-length-prop.js
vendored
Normal file
49
test/built-ins/TypedArray/prototype/copyWithin/BigInt/get-length-ignores-length-prop.js
vendored
Normal file
@ -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);
|
||||||
|
});
|
29
test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-func.js
vendored
Normal file
29
test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-func.js
vendored
Normal file
@ -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();
|
||||||
|
});
|
29
test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-method.js
vendored
Normal file
29
test/built-ins/TypedArray/prototype/copyWithin/BigInt/invoked-as-method.js
vendored
Normal file
@ -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();
|
||||||
|
});
|
30
test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js
vendored
Normal file
30
test/built-ins/TypedArray/prototype/copyWithin/BigInt/length.js
vendored
Normal file
@ -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");
|
27
test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js
vendored
Normal file
27
test/built-ins/TypedArray/prototype/copyWithin/BigInt/name.js
vendored
Normal file
@ -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");
|
95
test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js
vendored
Normal file
95
test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-end.js
vendored
Normal file
@ -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]'
|
||||||
|
);
|
||||||
|
});
|
111
test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js
vendored
Normal file
111
test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-end.js
vendored
Normal file
@ -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]'
|
||||||
|
);
|
||||||
|
});
|
93
test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js
vendored
Normal file
93
test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-start.js
vendored
Normal file
@ -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]'
|
||||||
|
);
|
||||||
|
});
|
61
test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js
vendored
Normal file
61
test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-out-of-bounds-target.js
vendored
Normal file
@ -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]'
|
||||||
|
);
|
||||||
|
});
|
77
test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js
vendored
Normal file
77
test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-start.js
vendored
Normal file
@ -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]'
|
||||||
|
);
|
||||||
|
});
|
53
test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js
vendored
Normal file
53
test/built-ins/TypedArray/prototype/copyWithin/BigInt/negative-target.js
vendored
Normal file
@ -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]'
|
||||||
|
);
|
||||||
|
});
|
54
test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js
vendored
Normal file
54
test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-out-of-bounds-end.js
vendored
Normal file
@ -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]'
|
||||||
|
);
|
||||||
|
});
|
@ -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]'
|
||||||
|
);
|
||||||
|
});
|
50
test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js
vendored
Normal file
50
test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-and-start.js
vendored
Normal file
@ -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]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
});
|
73
test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js
vendored
Normal file
73
test/built-ins/TypedArray/prototype/copyWithin/BigInt/non-negative-target-start-and-end.js
vendored
Normal file
@ -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]'
|
||||||
|
);
|
||||||
|
});
|
19
test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js
vendored
Normal file
19
test/built-ins/TypedArray/prototype/copyWithin/BigInt/prop-desc.js
vendored
Normal file
@ -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');
|
36
test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end-is-symbol.js
vendored
Normal file
36
test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end-is-symbol.js
vendored
Normal file
@ -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);
|
||||||
|
});
|
||||||
|
});
|
39
test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end.js
vendored
Normal file
39
test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-end.js
vendored
Normal file
@ -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);
|
||||||
|
});
|
||||||
|
});
|
35
test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start-is-symbol.js
vendored
Normal file
35
test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start-is-symbol.js
vendored
Normal file
@ -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);
|
||||||
|
});
|
||||||
|
});
|
45
test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start.js
vendored
Normal file
45
test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-start.js
vendored
Normal file
@ -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);
|
||||||
|
});
|
||||||
|
});
|
35
test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target-is-symbol.js
vendored
Normal file
35
test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target-is-symbol.js
vendored
Normal file
@ -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);
|
||||||
|
});
|
||||||
|
});
|
39
test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target.js
vendored
Normal file
39
test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-abrupt-from-target.js
vendored
Normal file
@ -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);
|
||||||
|
});
|
||||||
|
});
|
36
test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js
vendored
Normal file
36
test/built-ins/TypedArray/prototype/copyWithin/BigInt/return-this.js
vendored
Normal file
@ -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);
|
||||||
|
});
|
50
test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-object.js
vendored
Normal file
50
test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-object.js
vendored
Normal file
@ -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");
|
42
test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-typedarray-instance.js
vendored
Normal file
42
test/built-ins/TypedArray/prototype/copyWithin/BigInt/this-is-not-typedarray-instance.js
vendored
Normal file
@ -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");
|
45
test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js
vendored
Normal file
45
test/built-ins/TypedArray/prototype/copyWithin/BigInt/undefined-end.js
vendored
Normal file
@ -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]'
|
||||||
|
);
|
||||||
|
});
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
/*---
|
/*---
|
||||||
esid: sec-%typedarray%.prototype.copywithin
|
esid: sec-%typedarray%.prototype.copywithin
|
||||||
es6id: 22.2.3.5
|
|
||||||
description: Preservation of bit-level encoding
|
description: Preservation of bit-level encoding
|
||||||
info: |
|
info: |
|
||||||
Array.prototype.copyWithin (target, start [ , end ] )
|
Array.prototype.copyWithin (target, start [ , end ] )
|
||||||
@ -14,6 +13,7 @@ info: |
|
|||||||
i. Let fromVal be ? Get(O, fromKey).
|
i. Let fromVal be ? Get(O, fromKey).
|
||||||
ii. Perform ? Set(O, toKey, fromVal, true).
|
ii. Perform ? Set(O, toKey, fromVal, true).
|
||||||
includes: [nans.js, compareArray.js, testTypedArray.js]
|
includes: [nans.js, compareArray.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
function body(FloatArray) {
|
function body(FloatArray) {
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
esid: sec-%typedarray%.prototype.copywithin
|
esid: sec-%typedarray%.prototype.copywithin
|
||||||
es6id: 22.2.3.5
|
|
||||||
description: >
|
description: >
|
||||||
end argument is coerced to an integer values.
|
end argument is coerced to an integer values.
|
||||||
info: |
|
info: |
|
||||||
@ -24,6 +23,7 @@ info: |
|
|||||||
ToInteger(end).
|
ToInteger(end).
|
||||||
...
|
...
|
||||||
includes: [compareArray.js, testTypedArray.js]
|
includes: [compareArray.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
testWithTypedArrayConstructors(function(TA) {
|
testWithTypedArrayConstructors(function(TA) {
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
esid: sec-%typedarray%.prototype.copywithin
|
esid: sec-%typedarray%.prototype.copywithin
|
||||||
es6id: 22.2.3.5
|
|
||||||
description: >
|
description: >
|
||||||
start argument is coerced to an integer value.
|
start argument is coerced to an integer value.
|
||||||
info: |
|
info: |
|
||||||
@ -23,6 +22,7 @@ info: |
|
|||||||
5. Let relativeStart be ? ToInteger(start).
|
5. Let relativeStart be ? ToInteger(start).
|
||||||
...
|
...
|
||||||
includes: [compareArray.js, testTypedArray.js]
|
includes: [compareArray.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
testWithTypedArrayConstructors(function(TA) {
|
testWithTypedArrayConstructors(function(TA) {
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
esid: sec-%typedarray%.prototype.copywithin
|
esid: sec-%typedarray%.prototype.copywithin
|
||||||
es6id: 22.2.3.5
|
|
||||||
description: >
|
description: >
|
||||||
target argument is coerced to an integer value.
|
target argument is coerced to an integer value.
|
||||||
info: |
|
info: |
|
||||||
@ -23,6 +22,7 @@ info: |
|
|||||||
3. Let relativeTarget be ? ToInteger(target).
|
3. Let relativeTarget be ? ToInteger(target).
|
||||||
...
|
...
|
||||||
includes: [compareArray.js, testTypedArray.js]
|
includes: [compareArray.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
testWithTypedArrayConstructors(function(TA) {
|
testWithTypedArrayConstructors(function(TA) {
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
esid: sec-%typedarray%.prototype.copywithin
|
esid: sec-%typedarray%.prototype.copywithin
|
||||||
es6id: 22.2.3.5
|
|
||||||
description: >
|
description: >
|
||||||
Unreachable abrupt from Get(O, "length") as [[ArrayLength]] is returned.
|
Unreachable abrupt from Get(O, "length") as [[ArrayLength]] is returned.
|
||||||
info: |
|
info: |
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.5
|
esid: sec-%typedarray%.prototype.copywithin
|
||||||
description: Throws a TypeError exception when invoked as a function
|
description: Throws a TypeError exception when invoked as a function
|
||||||
info: |
|
info: |
|
||||||
22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [, end ] )
|
22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [, end ] )
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.5
|
esid: sec-%typedarray%.prototype.copywithin
|
||||||
description: Requires a [[TypedArrayName]] internal slot.
|
description: Requires a [[TypedArrayName]] internal slot.
|
||||||
info: |
|
info: |
|
||||||
22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [, end ] )
|
22.2.3.5 %TypedArray%.prototype.copyWithin (target, start [, end ] )
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.5
|
esid: sec-%typedarray%.prototype.copywithin
|
||||||
description: >
|
description: >
|
||||||
%TypedArray%.prototype.copyWithin.length is 2.
|
%TypedArray%.prototype.copyWithin.length is 2.
|
||||||
info: |
|
info: |
|
||||||
@ -20,6 +20,7 @@ info: |
|
|||||||
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
|
object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
|
||||||
[[Configurable]]: true }.
|
[[Configurable]]: true }.
|
||||||
includes: [propertyHelper.js, testTypedArray.js]
|
includes: [propertyHelper.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert.sameValue(TypedArray.prototype.copyWithin.length, 2);
|
assert.sameValue(TypedArray.prototype.copyWithin.length, 2);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
/*---
|
/*---
|
||||||
es6id: 22.2.3.5
|
esid: sec-%typedarray%.prototype.copywithin
|
||||||
description: >
|
description: >
|
||||||
%TypedArray%.prototype.copyWithin.name is "copyWithin".
|
%TypedArray%.prototype.copyWithin.name is "copyWithin".
|
||||||
info: |
|
info: |
|
||||||
@ -17,6 +17,7 @@ info: |
|
|||||||
object, if it exists, has the attributes { [[Writable]]: false,
|
object, if it exists, has the attributes { [[Writable]]: false,
|
||||||
[[Enumerable]]: false, [[Configurable]]: true }.
|
[[Enumerable]]: false, [[Configurable]]: true }.
|
||||||
includes: [propertyHelper.js, testTypedArray.js]
|
includes: [propertyHelper.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
assert.sameValue(TypedArray.prototype.copyWithin.name, "copyWithin");
|
assert.sameValue(TypedArray.prototype.copyWithin.name, "copyWithin");
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
esid: sec-%typedarray%.prototype.copywithin
|
esid: sec-%typedarray%.prototype.copywithin
|
||||||
es6id: 22.2.3.5
|
|
||||||
description: >
|
description: >
|
||||||
Set values with negative end argument.
|
Set values with negative end argument.
|
||||||
info: |
|
info: |
|
||||||
@ -26,6 +25,7 @@ info: |
|
|||||||
final be min(relativeEnd, len).
|
final be min(relativeEnd, len).
|
||||||
...
|
...
|
||||||
includes: [compareArray.js, testTypedArray.js]
|
includes: [compareArray.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
testWithTypedArrayConstructors(function(TA) {
|
testWithTypedArrayConstructors(function(TA) {
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
esid: sec-%typedarray%.prototype.copywithin
|
esid: sec-%typedarray%.prototype.copywithin
|
||||||
es6id: 22.2.3.5
|
|
||||||
description: >
|
description: >
|
||||||
Set values with negative out of bounds end argument.
|
Set values with negative out of bounds end argument.
|
||||||
info: |
|
info: |
|
||||||
@ -26,6 +25,7 @@ info: |
|
|||||||
final be min(relativeEnd, len).
|
final be min(relativeEnd, len).
|
||||||
...
|
...
|
||||||
includes: [compareArray.js, testTypedArray.js]
|
includes: [compareArray.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
testWithTypedArrayConstructors(function(TA) {
|
testWithTypedArrayConstructors(function(TA) {
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
esid: sec-%typedarray%.prototype.copywithin
|
esid: sec-%typedarray%.prototype.copywithin
|
||||||
es6id: 22.2.3.5
|
|
||||||
description: >
|
description: >
|
||||||
Set values with out of bounds negative start argument.
|
Set values with out of bounds negative start argument.
|
||||||
info: |
|
info: |
|
||||||
@ -24,6 +23,7 @@ info: |
|
|||||||
from be min(relativeStart, len).
|
from be min(relativeStart, len).
|
||||||
...
|
...
|
||||||
includes: [compareArray.js, testTypedArray.js]
|
includes: [compareArray.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
testWithTypedArrayConstructors(function(TA) {
|
testWithTypedArrayConstructors(function(TA) {
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
esid: sec-%typedarray%.prototype.copywithin
|
esid: sec-%typedarray%.prototype.copywithin
|
||||||
es6id: 22.2.3.5
|
|
||||||
description: >
|
description: >
|
||||||
Set values with out of bounds negative target argument.
|
Set values with out of bounds negative target argument.
|
||||||
info: |
|
info: |
|
||||||
@ -24,6 +23,7 @@ info: |
|
|||||||
to be min(relativeTarget, len).
|
to be min(relativeTarget, len).
|
||||||
...
|
...
|
||||||
includes: [compareArray.js, testTypedArray.js]
|
includes: [compareArray.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
testWithTypedArrayConstructors(function(TA) {
|
testWithTypedArrayConstructors(function(TA) {
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
esid: sec-%typedarray%.prototype.copywithin
|
esid: sec-%typedarray%.prototype.copywithin
|
||||||
es6id: 22.2.3.5
|
|
||||||
description: >
|
description: >
|
||||||
Set values with negative start argument.
|
Set values with negative start argument.
|
||||||
info: |
|
info: |
|
||||||
@ -24,6 +23,7 @@ info: |
|
|||||||
from be min(relativeStart, len).
|
from be min(relativeStart, len).
|
||||||
...
|
...
|
||||||
includes: [compareArray.js, testTypedArray.js]
|
includes: [compareArray.js, testTypedArray.js]
|
||||||
|
features: [TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
testWithTypedArrayConstructors(function(TA) {
|
testWithTypedArrayConstructors(function(TA) {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user