summaryrefslogtreecommitdiff
path: root/harness
diff options
context:
space:
mode:
Diffstat (limited to 'harness')
-rw-r--r--harness/testTypedArray.js20
1 files changed, 18 insertions, 2 deletions
diff --git a/harness/testTypedArray.js b/harness/testTypedArray.js
index 2699214ca..7f777b56c 100644
--- a/harness/testTypedArray.js
+++ b/harness/testTypedArray.js
@@ -20,11 +20,22 @@ var typedArrayConstructors = [
Uint8ClampedArray
];
+var numericTypedArrayConstructors = typedArrayConstructors.slice();
+
+if (typeof BigInt !== "undefined") {
+ typedArrayConstructors.push(BigInt64Array);
+ typedArrayConstructors.push(BigUint64Array);
+}
+
/**
* The %TypedArray% intrinsic constructor function.
*/
var TypedArray = Object.getPrototypeOf(Int8Array);
+function convertToBigInt(x) {
+ return (Array.isArray(x)) ? x.map(convertToBigInt) : BigInt(x);
+}
+
/**
* Callback for testing a typed array constructor.
*
@@ -41,9 +52,14 @@ var TypedArray = Object.getPrototypeOf(Int8Array);
function testWithTypedArrayConstructors(f, selected) {
var constructors = selected || typedArrayConstructors;
for (var i = 0; i < constructors.length; ++i) {
+ var N = function(x) { return x; };
var constructor = constructors[i];
+ if (constructor.name == "BigInt64Array" ||
+ constructor.name == "BigUint64Array") {
+ N = convertToBigInt;
+ }
try {
- f(constructor);
+ f(constructor, N);
} catch (e) {
e.message += " (Testing with " + constructor.name + ".)";
throw e;
@@ -75,5 +91,5 @@ function testTypedArrayConversions(byteConversionValues, fn) {
}
fn(TA, value, exp, initial);
});
- });
+ }, numericTypedArrayConstructors);
}