summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array')
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/BYTES_PER_ELEMENT.js26
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/constructor.js21
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/is-a-constructor.js26
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/length.js30
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/name.js38
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prop-desc.js19
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/proto.js18
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype.js26
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/BYTES_PER_ELEMENT.js26
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/constructor.js25
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/not-typedarray-object.js20
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/proto.js19
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/shell.js148
16 files changed, 442 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/BYTES_PER_ELEMENT.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/BYTES_PER_ELEMENT.js
new file mode 100644
index 0000000000..cc0ec24ce5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/BYTES_PER_ELEMENT.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2017 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-typedarray.bytes_per_element
+description: BigInt64Array.BYTES_PER_ELEMENT property descriptor
+info: |
+ 22.2.5.1 TypedArray.BYTES_PER_ELEMENT
+
+ The value of TypedArray.BYTES_PER_ELEMENT is the Number value of the
+ Element Size value specified in Table 52 for TypedArray.
+
+ This property has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: false }.
+includes: [propertyHelper.js]
+features: [BigInt]
+---*/
+
+verifyProperty(BigInt64Array, "BYTES_PER_ELEMENT", {
+ value: 8,
+ writable: false,
+ enumerable: false,
+ configurable: false
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/browser.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/browser.js
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/constructor.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/constructor.js
new file mode 100644
index 0000000000..940076e123
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/constructor.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2017 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-typedarray-constructors
+description: BigInt64Array is a constructor function
+info: |
+ 22.2.4 The TypedArray Constructors
+
+ [...]
+
+ The TypedArray intrinsic constructor functions are single functions
+ whose behaviour is overloaded based upon the number and types of its
+ arguments. The actual behaviour of a call of TypedArray depends upon
+ the number and kind of arguments that are passed to it.
+features: [BigInt]
+---*/
+
+assert.sameValue(typeof BigInt64Array, "function");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/is-a-constructor.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/is-a-constructor.js
new file mode 100644
index 0000000000..a61e34ba33
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/is-a-constructor.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ The BigInt64Array constructor implements [[Construct]]
+info: |
+ IsConstructor ( argument )
+
+ The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
+ It determines if argument is a function object with a [[Construct]] internal method.
+ It performs the following steps when called:
+
+ If Type(argument) is not Object, return false.
+ If argument has a [[Construct]] internal method, return true.
+ Return false.
+includes: [isConstructor.js]
+features: [Reflect.construct, BigInt, TypedArray]
+---*/
+
+assert.sameValue(isConstructor(BigInt64Array), true, 'isConstructor(BigInt64Array) must return true');
+new BigInt64Array();
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/length.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/length.js
new file mode 100644
index 0000000000..f8ee7d0f73
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/length.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2017 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-typedarray-constructors
+description: BigInt64Array.length property descriptor
+info: |
+ The TypedArray Constructors
+
+ The length property of the TypedArray constructor function is 3.
+
+ 17 ECMAScript Standard Built-in Objects
+
+ ...
+
+ Unless otherwise specified, the length property of a built-in function
+ object has the attributes { [[Writable]]: false, [[Enumerable]]: false,
+ [[Configurable]]: true }.
+includes: [propertyHelper.js]
+features: [BigInt, TypedArray]
+---*/
+
+verifyProperty(BigInt64Array, "length", {
+ value: 3,
+ writable: false,
+ enumerable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/name.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/name.js
new file mode 100644
index 0000000000..683f829815
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/name.js
@@ -0,0 +1,38 @@
+// Copyright (C) 2017 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-properties-of-the-typedarray-constructors
+description: BigInt64Array.name property descriptor
+info: |
+ 22.2.5 Properties of the TypedArray Constructors
+
+ [...]
+
+ Each TypedArray constructor has a name property whose value is the
+ String value of the constructor name specified for it in Table 52.
+
+ 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, this value is the name that
+ is given to the function in this specification. For functions that
+ are specified as properties of objects, the name value is the
+ property name string used to access the function. [...]
+
+ 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]
+features: [BigInt]
+---*/
+
+verifyProperty(BigInt64Array, "name", {
+ value: "BigInt64Array",
+ writable: false,
+ enumerable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prop-desc.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prop-desc.js
new file mode 100644
index 0000000000..6ddc794bd8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prop-desc.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2017 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-typedarray-objects
+description: BigInt64Array property descriptor
+info: |
+ 17 ECMAScript Standard Built-in Objects
+includes: [propertyHelper.js]
+features: [BigInt]
+---*/
+
+verifyProperty(this, "BigInt64Array", {
+ writable: true,
+ enumerable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/proto.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/proto.js
new file mode 100644
index 0000000000..23e5d1da1d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/proto.js
@@ -0,0 +1,18 @@
+// Copyright (C) 2017 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-properties-of-the-typedarray-constructors
+description: BigInt64Array prototype internal slot
+info: |
+ 22.2.5 Properties of the TypedArray Constructors
+
+ The value of the [[Prototype]] internal slot of each TypedArray
+ constructor is the %TypedArray% intrinsic object.
+includes: [testTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(Object.getPrototypeOf(BigInt64Array), TypedArray);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype.js
new file mode 100644
index 0000000000..41a7afcb84
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2017 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-typedarray.prototype
+description: BigInt64Array.prototype property descriptor
+info: |
+ 22.2.5.2 TypedArray.prototype
+
+ The initial value of TypedArray.prototype is the corresponding
+ TypedArray prototype intrinsic object (22.2.6).
+
+ This property has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: false }.
+includes: [propertyHelper.js]
+features: [BigInt]
+---*/
+
+verifyProperty(BigInt64Array, "prototype", {
+ value: Object.getPrototypeOf(new BigInt64Array()),
+ writable: false,
+ enumerable: false,
+ configurable: false
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/BYTES_PER_ELEMENT.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/BYTES_PER_ELEMENT.js
new file mode 100644
index 0000000000..135681804d
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/BYTES_PER_ELEMENT.js
@@ -0,0 +1,26 @@
+// Copyright (C) 2017 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-typedarray.prototype.bytes_per_element
+description: BigInt64Array.prototype.BYTES_PER_ELEMENT property descriptor
+info: |
+ 22.2.5.1 TypedArray.prototype.BYTES_PER_ELEMENT
+
+ The value of TypedArray.prototype.BYTES_PER_ELEMENT is the Number
+ value of the Element Size value specified in Table 52 for TypedArray.
+
+ This property has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: false }.
+includes: [propertyHelper.js]
+features: [BigInt]
+---*/
+
+verifyProperty(BigInt64Array.prototype, "BYTES_PER_ELEMENT", {
+ value: 8,
+ writable: false,
+ enumerable: false,
+ configurable: false
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/browser.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/browser.js
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/constructor.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/constructor.js
new file mode 100644
index 0000000000..5b10a19b66
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/constructor.js
@@ -0,0 +1,25 @@
+// Copyright (C) 2017 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-typedarray.prototype.constructor
+description: BigInt64Array.prototype.constructor property descriptor
+info: |
+ 22.2.6.2 TypedArray.prototype.constructor
+
+ The initial value of a TypedArray.prototype.constructor is the
+ corresponding %TypedArray% intrinsic object.
+
+ 17 ECMAScript Standard Built-in Objects
+includes: [propertyHelper.js]
+features: [BigInt]
+---*/
+
+verifyProperty(BigInt64Array.prototype, "constructor", {
+ value: BigInt64Array,
+ writable: true,
+ enumerable: false,
+ configurable: true
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/not-typedarray-object.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/not-typedarray-object.js
new file mode 100644
index 0000000000..716b051ec3
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/not-typedarray-object.js
@@ -0,0 +1,20 @@
+// Copyright (C) 2017 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-properties-of-typedarray-prototype-objects
+description: BigInt64Array.prototype is not a TypedArray instance
+info: |
+ 22.2.6 Properties of TypedArray Prototype Objects
+
+ [...] A TypedArray prototype object is an ordinary object. It does not
+ have a [[ViewedArrayBuffer]] or any other of the internal slots that
+ are specific to TypedArray instance objects.
+features: [BigInt]
+---*/
+assert.sameValue(typeof BigInt64Array, 'function');
+assert.throws(TypeError, function () {
+ BigInt64Array.prototype.buffer;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/proto.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/proto.js
new file mode 100644
index 0000000000..460aaca932
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/proto.js
@@ -0,0 +1,19 @@
+// Copyright (C) 2017 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-properties-of-typedarray-prototype-objects
+description: BigInt64Array.prototype prototype internal slot
+info: |
+ 22.2.6 Properties of TypedArray Prototype Objects
+
+ The value of the [[Prototype]] internal slot of a TypedArray prototype
+ object is the intrinsic object %TypedArrayPrototype%. [...]
+includes: [testTypedArray.js]
+features: [BigInt, TypedArray]
+---*/
+
+assert.sameValue(Object.getPrototypeOf(BigInt64Array.prototype),
+ TypedArray.prototype);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/shell.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/prototype/shell.js
diff --git a/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/shell.js b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/shell.js
new file mode 100644
index 0000000000..7b3c8c67d8
--- /dev/null
+++ b/js/src/tests/test262/built-ins/TypedArrayConstructors/BigInt64Array/shell.js
@@ -0,0 +1,148 @@
+// GENERATED, DO NOT EDIT
+// file: isConstructor.js
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: |
+ Test if a given function is a constructor function.
+defines: [isConstructor]
+features: [Reflect.construct]
+---*/
+
+function isConstructor(f) {
+ if (typeof f !== "function") {
+ throw new Test262Error("isConstructor invoked with a non-function value");
+ }
+
+ try {
+ Reflect.construct(function(){}, [], f);
+ } catch (e) {
+ return false;
+ }
+ return true;
+}
+
+// file: testTypedArray.js
+// 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 TypedArray objects.
+defines:
+ - typedArrayConstructors
+ - floatArrayConstructors
+ - intArrayConstructors
+ - TypedArray
+ - testWithTypedArrayConstructors
+ - testWithAtomicsFriendlyTypedArrayConstructors
+ - testWithNonAtomicsFriendlyTypedArrayConstructors
+ - testTypedArrayConversions
+---*/
+
+/**
+ * Array containing every typed array constructor.
+ */
+var typedArrayConstructors = [
+ Float64Array,
+ Float32Array,
+ Int32Array,
+ Int16Array,
+ Int8Array,
+ Uint32Array,
+ Uint16Array,
+ Uint8Array,
+ Uint8ClampedArray
+];
+
+var floatArrayConstructors = typedArrayConstructors.slice(0, 2);
+var intArrayConstructors = typedArrayConstructors.slice(2, 7);
+
+/**
+ * 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 testWithTypedArrayConstructors(f, selected) {
+ var constructors = selected || typedArrayConstructors;
+ 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;
+ }
+ }
+}
+
+/**
+ * Calls the provided function for every non-"Atomics Friendly" 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 testWithNonAtomicsFriendlyTypedArrayConstructors(f) {
+ testWithTypedArrayConstructors(f, [
+ Float64Array,
+ Float32Array,
+ Uint8ClampedArray
+ ]);
+}
+
+/**
+ * Calls the provided function for every "Atomics Friendly" 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 testWithAtomicsFriendlyTypedArrayConstructors(f) {
+ testWithTypedArrayConstructors(f, [
+ Int32Array,
+ Int16Array,
+ Int8Array,
+ Uint32Array,
+ Uint16Array,
+ Uint8Array,
+ ]);
+}
+
+/**
+ * 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 testTypedArrayConversions(byteConversionValues, fn) {
+ var values = byteConversionValues.values;
+ var expected = byteConversionValues.expected;
+
+ testWithTypedArrayConstructors(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);
+ });
+ });
+}