From c47b716e8d6bea0c4510d449fd22b7ed5f8b0151 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bargull?= Date: Mon, 24 Jun 2024 15:39:02 +0200 Subject: [PATCH] Update harness tests for Float16Array Fixes #4029 --- test/harness/testTypedArray-conversions.js | 3 +++ test/harness/testTypedArray.js | 27 ++++++++++++++-------- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/test/harness/testTypedArray-conversions.js b/test/harness/testTypedArray-conversions.js index d0d27fe5fe..4449bb464c 100644 --- a/test/harness/testTypedArray-conversions.js +++ b/test/harness/testTypedArray-conversions.js @@ -36,6 +36,9 @@ var bcv = { Uint32: [ 127, ], + Float16: [ + 127, + ], Float32: [ 127, ], diff --git a/test/harness/testTypedArray.js b/test/harness/testTypedArray.js index 1d4111b233..796ec7a989 100644 --- a/test/harness/testTypedArray.js +++ b/test/harness/testTypedArray.js @@ -17,16 +17,23 @@ features: [TypedArray] assert(typeof TypedArray === "function"); assert.sameValue(TypedArray, Object.getPrototypeOf(Uint8Array)); +var hasFloat16Array = typeof Float16Array !== 'undefined'; + var callCount = 0; testWithTypedArrayConstructors(() => callCount++); -assert.sameValue(callCount, 9); +assert.sameValue(callCount, 9 + hasFloat16Array); -assert.sameValue(typedArrayConstructors[0], Float64Array); -assert.sameValue(typedArrayConstructors[1], Float32Array); -assert.sameValue(typedArrayConstructors[2], Int32Array); -assert.sameValue(typedArrayConstructors[3], Int16Array); -assert.sameValue(typedArrayConstructors[4], Int8Array); -assert.sameValue(typedArrayConstructors[5], Uint32Array); -assert.sameValue(typedArrayConstructors[6], Uint16Array); -assert.sameValue(typedArrayConstructors[7], Uint8Array); -assert.sameValue(typedArrayConstructors[8], Uint8ClampedArray); +var index = 0; + +assert.sameValue(typedArrayConstructors[index++], Float64Array); +assert.sameValue(typedArrayConstructors[index++], Float32Array); +if (hasFloat16Array) { + assert.sameValue(typedArrayConstructors[index++], Float16Array); +} +assert.sameValue(typedArrayConstructors[index++], Int32Array); +assert.sameValue(typedArrayConstructors[index++], Int16Array); +assert.sameValue(typedArrayConstructors[index++], Int8Array); +assert.sameValue(typedArrayConstructors[index++], Uint32Array); +assert.sameValue(typedArrayConstructors[index++], Uint16Array); +assert.sameValue(typedArrayConstructors[index++], Uint8Array); +assert.sameValue(typedArrayConstructors[index++], Uint8ClampedArray);