Skip to content

Commit 6b6cca8

Browse files
bakkotmoz-wptsync-bot
authored andcommitted
Bug 1889292 [wpt PR 45483] - update tests which are generic across all TypedArrays for Float16Array, a=testonly
Automatic update from web-platform-tests Update tests which are generic across all TypedArrays for Float16Array For whatwg/webidl#1398. -- wpt-commits: 5aa50dd4151b5bc1d04d5505366c6e27df30af5b wpt-pr: 45483
1 parent 2ee4c72 commit 6b6cca8

File tree

16 files changed

+76
-2
lines changed

16 files changed

+76
-2
lines changed

testing/web-platform/tests/FileAPI/blob/Blob-constructor.any.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,11 @@ test_blob(function() {
290290
new Int16Array([0x4150, 0x5353]),
291291
new Uint32Array([0x53534150]),
292292
new Int32Array([0x53534150]),
293+
new Float16Array([2.65625, 58.59375]),
293294
new Float32Array([0xD341500000])
294295
]);
295296
}, {
296-
expected: "PASSPASSPASSPASSPASSPASSPASS",
297+
expected: "PASSPASSPASSPASSPASSPASSPASSPASS",
297298
type: "",
298299
desc: "Passing typed arrays as elements of the blobParts array should work."
299300
});

testing/web-platform/tests/IndexedDB/idb-binary-key-roundtrip.htm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
'Int16Array',
8484
'Uint32Array',
8585
'Int32Array',
86+
'Float16Array',
8687
'Float32Array',
8788
'Float64Array'
8889
].forEach((type) => { view_type_test(type); });

testing/web-platform/tests/IndexedDB/structured-clone.any.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ cloneObjectTest(new Uint8Array([0, 1, 254, 255]).buffer, (orig, clone) => {
178178
new Int16Array([0x0000, 0x0001, 0xFFFE, 0xFFFF]),
179179
new Int32Array([0x00000000, 0x00000001, 0xFFFFFFFE, 0xFFFFFFFF]),
180180
new Uint8ClampedArray([0, 1, 254, 255]),
181+
new Float16Array([-Infinity, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, Infinity, NaN]),
181182
new Float32Array([-Infinity, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, Infinity, NaN]),
182183
new Float64Array([-Infinity, -Number.MAX_VALUE, -Number.MIN_VALUE, 0,
183184
Number.MIN_VALUE, Number.MAX_VALUE, Infinity, NaN])

testing/web-platform/tests/WebCryptoAPI/getRandomValues.any.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
// Step 1.
22
test(function() {
3+
assert_throws_dom("TypeMismatchError", function() {
4+
self.crypto.getRandomValues(new Float16Array(6))
5+
}, "Float16Array")
36
assert_throws_dom("TypeMismatchError", function() {
47
self.crypto.getRandomValues(new Float32Array(6))
58
}, "Float32Array")
69
assert_throws_dom("TypeMismatchError", function() {
710
self.crypto.getRandomValues(new Float64Array(6))
811
}, "Float64Array")
912

13+
assert_throws_dom("TypeMismatchError", function() {
14+
const len = 65536 / Float16Array.BYTES_PER_ELEMENT + 1;
15+
self.crypto.getRandomValues(new Float16Array(len));
16+
}, "Float16Array (too long)")
1017
assert_throws_dom("TypeMismatchError", function() {
1118
const len = 65536 / Float32Array.BYTES_PER_ELEMENT + 1;
1219
self.crypto.getRandomValues(new Float32Array(len));

testing/web-platform/tests/compression/decompression-buffersource.tentative.any.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ const bufferSourceChunksForDeflate = [
4747
name: 'Uint32Array',
4848
value: new Uint32Array(new Uint8Array(compressedBytesWithDeflate).buffer)
4949
},
50+
{
51+
name: 'Float16Array',
52+
value: new Float16Array(new Uint8Array(compressedBytesWithDeflate).buffer)
53+
},
5054
{
5155
name: 'Float32Array',
5256
value: new Float32Array(new Uint8Array(compressedBytesWithDeflate).buffer)
@@ -94,6 +98,10 @@ const bufferSourceChunksForGzip = [
9498
name: 'Uint32Array',
9599
value: new Uint32Array(new Uint8Array(compressedBytesWithGzip).buffer)
96100
},
101+
{
102+
name: 'Float16Array',
103+
value: new Float16Array(new Uint8Array(compressedBytesWithGzip).buffer)
104+
},
97105
{
98106
name: 'Float32Array',
99107
value: new Float32Array(new Uint8Array(compressedBytesWithGzip).buffer)
@@ -141,6 +149,10 @@ const bufferSourceChunksForDeflateRaw = [
141149
name: 'Uint32Array',
142150
value: new Uint32Array(new Uint8Array(compressedBytesWithDeflateRaw).buffer)
143151
},
152+
{
153+
name: 'Float16Array',
154+
value: new Float16Array(new Uint8Array(compressedBytesWithDeflateRaw).buffer)
155+
},
144156
{
145157
name: 'Float32Array',
146158
value: new Float32Array(new Uint8Array(compressedBytesWithDeflateRaw).buffer)

testing/web-platform/tests/encoding/encodeInto.any.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
"Uint8ClampedArray",
130130
"BigInt64Array",
131131
"BigUint64Array",
132+
"Float16Array",
132133
"Float32Array",
133134
"Float64Array"].forEach(type => {
134135
["ArrayBuffer", "SharedArrayBuffer"].forEach((arrayBufferOrSharedArrayBuffer) => {

testing/web-platform/tests/fetch/api/basic/request-headers.any.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ requestHeaders("Fetch with POST with Blob body", url, "POST", new Blob(["Test"])
5454
requestHeaders("Fetch with POST with ArrayBuffer body", url, "POST", new ArrayBuffer(4), location.origin, "4");
5555
requestHeaders("Fetch with POST with Uint8Array body", url, "POST", new Uint8Array(4), location.origin, "4");
5656
requestHeaders("Fetch with POST with Int8Array body", url, "POST", new Int8Array(4), location.origin, "4");
57+
requestHeaders("Fetch with POST with Float16Array body", url, "POST", new Float16Array(1), location.origin, "2");
5758
requestHeaders("Fetch with POST with Float32Array body", url, "POST", new Float32Array(1), location.origin, "4");
5859
requestHeaders("Fetch with POST with Float64Array body", url, "POST", new Float64Array(1), location.origin, "8");
5960
requestHeaders("Fetch with POST with DataView body", url, "POST", new DataView(new ArrayBuffer(8), 0, 4), location.origin, "4");

testing/web-platform/tests/fetch/api/basic/request-upload.any.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ testUpload("Fetch with POST with Int8Array body", url,
6060
"POST",
6161
() => new Int8Array(4),
6262
"\0\0\0\0");
63+
testUpload("Fetch with POST with Float16Array body", url,
64+
"POST",
65+
() => new Float16Array(2),
66+
"\0\0\0\0");
6367
testUpload("Fetch with POST with Float32Array body", url,
6468
"POST",
6569
() => new Float32Array(1),

testing/web-platform/tests/fetch/api/response/response-clone.any.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ testReadableStreamClone(new Uint16Array(arrayBuffer, 2), "Uint16Array");
135135
testReadableStreamClone(new Uint32Array(arrayBuffer), "Uint32Array");
136136
testReadableStreamClone(typeof BigInt64Array === "function" ? new BigInt64Array(arrayBuffer) : undefined, "BigInt64Array");
137137
testReadableStreamClone(typeof BigUint64Array === "function" ? new BigUint64Array(arrayBuffer) : undefined, "BigUint64Array");
138+
testReadableStreamClone(typeof Float16Array === "function" ? new Float16Array(arrayBuffer) : undefined, "Float16Array");
138139
testReadableStreamClone(new Float32Array(arrayBuffer), "Float32Array");
139140
testReadableStreamClone(new Float64Array(arrayBuffer), "Float64Array");
140141
testReadableStreamClone(new DataView(arrayBuffer, 2, 8), "DataView");

testing/web-platform/tests/html/infrastructure/safe-passing-of-structured-data/shared-array-buffers/window-simple-success.https.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"Uint32Array",
2424
"BigInt64Array",
2525
"BigUint64Array",
26+
"Float16Array",
2627
"Float32Array",
2728
"Float64Array"
2829
].forEach(type => {

testing/web-platform/tests/resources/idlharness.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@ IdlArray.prototype.is_json_type = function(type)
566566
case "Uint8ClampedArray":
567567
case "BigInt64Array":
568568
case "BigUint64Array":
569+
case "Float16Array":
569570
case "Float32Array":
570571
case "Float64Array":
571572
case "ArrayBuffer":

testing/web-platform/tests/resources/test/tests/unit/IdlArray/is_json_type.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
assert_false(idl.is_json_type(typeFrom("Uint8ClampedArray")));
4040
assert_false(idl.is_json_type(typeFrom("BigInt64Array")));
4141
assert_false(idl.is_json_type(typeFrom("BigUint64Array")));
42+
assert_false(idl.is_json_type(typeFrom("Float16Array")));
4243
assert_false(idl.is_json_type(typeFrom("Float32Array")));
4344
assert_false(idl.is_json_type(typeFrom("Float64Array")));
4445
assert_false(idl.is_json_type(typeFrom("ArrayBuffer")));
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// META: script=constants.sub.js
2+
// META: variant=?default
3+
// META: variant=?wpt_flags=h2
4+
// META: variant=?wss
5+
6+
var test = async_test("Send binary data on a WebSocket - ArrayBufferView - Float16Array - Connection should be closed");
7+
8+
var data = "";
9+
var datasize = 4;
10+
var view;
11+
var wsocket = CreateWebSocket(false, false);
12+
var isOpenCalled = false;
13+
var isMessageCalled = false;
14+
15+
wsocket.addEventListener('open', test.step_func(function(evt) {
16+
wsocket.binaryType = "arraybuffer";
17+
data = new ArrayBuffer(datasize);
18+
view = new Float16Array(data);
19+
for (var i = 0; i < 2; i++) {
20+
view[i] = i;
21+
}
22+
wsocket.send(view);
23+
isOpenCalled = true;
24+
}), true);
25+
26+
wsocket.addEventListener('message', test.step_func(function(evt) {
27+
isMessageCalled = true;
28+
var resultView = new Float16Array(evt.data);
29+
for (var i = 0; i < resultView.length; i++) {
30+
assert_equals(resultView[i], view[i], "ArrayBufferView returned is the same");
31+
}
32+
wsocket.close();
33+
}), true);
34+
35+
wsocket.addEventListener('close', test.step_func(function(evt) {
36+
assert_true(isOpenCalled, "WebSocket connection should be open");
37+
assert_true(isMessageCalled, "message should be received")
38+
assert_equals(evt.wasClean, true, "wasClean should be true");
39+
test.done();
40+
}), true);

testing/web-platform/tests/workers/semantics/interface-objects/001.worker.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var expected = [
3030
"Uint16Array",
3131
"Int32Array",
3232
"Uint32Array",
33+
"Float16Array",
3334
"Float32Array",
3435
"Float64Array",
3536
"DataView",

testing/web-platform/tests/workers/semantics/interface-objects/003.any.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ var expected = [
3030
"Uint16Array",
3131
"Int32Array",
3232
"Uint32Array",
33+
"Float16Array",
3334
"Float32Array",
3435
"Float64Array",
3536
"DataView",

testing/web-platform/tests/xhr/send-data-sharedarraybuffer.any.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test(() => {
1313

1414
["Int8Array", "Uint8Array", "Uint8ClampedArray", "Int16Array", "Uint16Array",
1515
"Int32Array", "Uint32Array", "BigInt64Array", "BigUint64Array",
16-
"Float32Array", "Float64Array", "DataView"].forEach((type) => {
16+
"Float16Array", "Float32Array", "Float64Array", "DataView"].forEach((type) => {
1717
test(() => {
1818
const xhr = new XMLHttpRequest();
1919
// See https://github.com/whatwg/html/issues/5380 for why not `new SharedArrayBuffer()`

0 commit comments

Comments
 (0)