|
86 | 86 | testing.expectEqual(expected, result); |
87 | 87 | }); |
88 | 88 | } |
| 89 | + |
| 90 | + // Test for SIMD. |
| 91 | + { |
| 92 | + const parts = [ |
| 93 | + "\rThe opened package\r\nof potato\nchi\rps", |
| 94 | + "held the\r\nanswer to the\r mystery. Both det\rectives looke\r\rd\r", |
| 95 | + "\rat it but failed to realize\nit was\r\nthe\rkey\r\n", |
| 96 | + "\r\nto solve the \rcrime.\r" |
| 97 | + ]; |
| 98 | + |
| 99 | + const blob = new Blob(parts, { type: "text/html", endings: "native" }); |
| 100 | + testing.expectEqual(161, blob.size); |
| 101 | + testing.expectEqual("text/html", blob.type); |
| 102 | + testing.async(blob.bytes(), result => { |
| 103 | + const expected = new Uint8Array([10, 84, 104, 101, 32, 111, 112, 101, 110, |
| 104 | + 101, 100, 32, 112, 97, 99, 107, 97, 103, |
| 105 | + 101, 10, 111, 102, 32, 112, 111, 116, 97, |
| 106 | + 116, 111, 10, 99, 104, 105, 10, 112, 115, |
| 107 | + 104, 101, 108, 100, 32, 116, 104, 101, 10, |
| 108 | + 97, 110, 115, 119, 101, 114, 32, 116, 111, |
| 109 | + 32, 116, 104, 101, 10, 32, 109, 121, 115, |
| 110 | + 116, 101, 114, 121, 46, 32, 66, 111, 116, |
| 111 | + 104, 32, 100, 101, 116, 10, 101, 99, 116, |
| 112 | + 105, 118, 101, 115, 32, 108, 111, 111, 107, |
| 113 | + 101, 10, 10, 100, 10, 10, 97, 116, 32, 105, |
| 114 | + 116, 32, 98, 117, 116, 32, 102, 97, 105, 108, |
| 115 | + 101, 100, 32, 116, 111, 32, 114, 101, 97, |
| 116 | + 108, 105, 122, 101, 10, 105, 116, 32, 119, 97, |
| 117 | + 115, 10, 116, 104, 101, 10, 107, 101, 121, |
| 118 | + 10, 10, 116, 111, 32, 115, 111, 108, 118, 101, |
| 119 | + 32, 116, 104, 101, 32, 10, 99, 114, 105, 109, |
| 120 | + 101, 46, 10]); |
| 121 | + testing.expectEqual(true, result instanceof Uint8Array); |
| 122 | + testing.expectEqual(expected, result); |
| 123 | + }); |
| 124 | + } |
89 | 125 | </script> |
0 commit comments