Skip to content

Commit

Permalink
Update harness tests for Float16Array
Browse files Browse the repository at this point in the history
Fixes tc39#4029
  • Loading branch information
anba committed Jun 24, 2024
1 parent 29c6f70 commit 8c83b81
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
3 changes: 3 additions & 0 deletions test/harness/testTypedArray-conversions.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ var bcv = {
Uint32: [
127,
],
Float16: [
127,
],
Float32: [
127,
],
Expand Down
29 changes: 18 additions & 11 deletions test/harness/testTypedArray.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(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);
assert.sameValue(callCount, 9 + hasFloat16Array);

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);

0 comments on commit 8c83b81

Please sign in to comment.