@everyonesoftware/common 1.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/publish.yml +54 -38
- package/package.json +9 -2
- package/sources/asyncIterator.ts +436 -436
- package/sources/asyncIteratorToJavascriptAsyncIteratorAdapter.ts +47 -47
- package/sources/asyncResult.ts +95 -95
- package/sources/byteList.ts +201 -201
- package/sources/byteListStream.ts +120 -120
- package/sources/byteReadStream.ts +23 -23
- package/sources/byteWriteStream.ts +15 -15
- package/sources/characterList.ts +194 -194
- package/sources/characterListStream.ts +150 -150
- package/sources/characterReadStream.ts +80 -80
- package/sources/characterReadStreamIterator.ts +127 -127
- package/sources/concatenateIterable.ts +118 -118
- package/sources/concatenateIterator.ts +164 -164
- package/sources/currentProcess.ts +157 -157
- package/sources/dateTime.ts +129 -129
- package/sources/depthFirstSearch.ts +229 -229
- package/sources/flatMapIterable.ts +103 -103
- package/sources/flatMapIterator.ts +151 -151
- package/sources/generator.ts +250 -250
- package/sources/index.ts +1 -1
- package/sources/iterator.ts +480 -480
- package/sources/javascriptAsyncIteratorToAsyncIteratorAdapter.ts +123 -123
- package/sources/javascriptSetSet.ts +133 -133
- package/sources/listQueue.ts +61 -61
- package/sources/listStack.ts +61 -61
- package/sources/luxonDateTime.ts +108 -108
- package/sources/mapAsyncIterator.ts +140 -140
- package/sources/mutableMap.ts +291 -291
- package/sources/node.ts +36 -36
- package/sources/promiseAsyncResult.ts +173 -173
- package/sources/queue.ts +48 -48
- package/sources/recreationDotGovClient.ts +258 -258
- package/sources/searchControl.ts +41 -41
- package/sources/set.ts +243 -243
- package/sources/skipAsyncIterator.ts +144 -144
- package/sources/stack.ts +47 -47
- package/sources/syncResult.ts +299 -299
- package/sources/takeAsyncIterator.ts +140 -140
- package/sources/whereAsyncIterator.ts +142 -142
- package/sources/wonderlandTrailClient.ts +1502 -1502
- package/tests/assertTestTests.ts +74 -74
- package/tests/byteListStreamTests.ts +389 -389
- package/tests/byteListTests.ts +26 -26
- package/tests/characterListStreamTests.ts +390 -390
- package/tests/characterListTests.ts +249 -249
- package/tests/dateTimeTests.ts +29 -29
- package/tests/depthFirstSearchTests.ts +105 -105
- package/tests/generatorTests.ts +85 -85
- package/tests/mutableMapTests.ts +153 -153
- package/tests/promiseAsyncResultTests.ts +687 -687
- package/tests/queueTests.ts +28 -28
- package/tests/recreationDotGovClientTests.ts +190 -190
- package/tests/setTests.ts +139 -139
- package/tests/stackTests.ts +65 -65
- package/tests/syncResultTests.ts +1250 -1250
- package/tests/wonderlandTrailClientTests.ts +451 -451
- package/tsconfig.json +3 -0
- package/tsup.config.ts +12 -12
|
@@ -1,390 +1,390 @@
|
|
|
1
|
-
import { ByteListStream } from "../sources/byteListStream";
|
|
2
|
-
import { EmptyError } from "../sources/emptyError";
|
|
3
|
-
import { PreConditionError } from "../sources/preConditionError";
|
|
4
|
-
import { Test } from "./test";
|
|
5
|
-
import { TestRunner } from "./testRunner";
|
|
6
|
-
|
|
7
|
-
export function test(runner: TestRunner): void
|
|
8
|
-
{
|
|
9
|
-
runner.testFile("byteListStream.ts", () =>
|
|
10
|
-
{
|
|
11
|
-
runner.testType("ByteListStream", () =>
|
|
12
|
-
{
|
|
13
|
-
runner.testFunction("create()", () =>
|
|
14
|
-
{
|
|
15
|
-
runner.test("with no arguments", (test: Test) =>
|
|
16
|
-
{
|
|
17
|
-
const stream: ByteListStream = ByteListStream.create();
|
|
18
|
-
test.assertNotUndefinedAndNotNull(stream);
|
|
19
|
-
test.assertEqual(0, stream.getAvailableByteCount());
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
runner.test("with empty array", (test: Test) =>
|
|
23
|
-
{
|
|
24
|
-
const stream: ByteListStream = ByteListStream.create([]);
|
|
25
|
-
test.assertNotUndefinedAndNotNull(stream);
|
|
26
|
-
test.assertEqual(0, stream.getAvailableByteCount());
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
runner.test("with non-empty array", (test: Test) =>
|
|
30
|
-
{
|
|
31
|
-
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
32
|
-
test.assertNotUndefinedAndNotNull(stream);
|
|
33
|
-
test.assertEqual(3, stream.getAvailableByteCount());
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
runner.testFunction("writeBytes()", () =>
|
|
38
|
-
{
|
|
39
|
-
runner.test("with undefined bytes", (test: Test) =>
|
|
40
|
-
{
|
|
41
|
-
const stream: ByteListStream = ByteListStream.create();
|
|
42
|
-
test.assertThrows(() => stream.writeBytes(undefined!), new PreConditionError(
|
|
43
|
-
"Expression: bytes",
|
|
44
|
-
"Expected: not undefined and not null",
|
|
45
|
-
"Actual: undefined",
|
|
46
|
-
));
|
|
47
|
-
test.assertEqual(0, stream.getAvailableByteCount());
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
runner.test("with null bytes", (test: Test) =>
|
|
51
|
-
{
|
|
52
|
-
const stream: ByteListStream = ByteListStream.create();
|
|
53
|
-
test.assertThrows(() => stream.writeBytes(null!), new PreConditionError(
|
|
54
|
-
"Expression: bytes",
|
|
55
|
-
"Expected: not undefined and not null",
|
|
56
|
-
"Actual: null",
|
|
57
|
-
));
|
|
58
|
-
test.assertEqual(0, stream.getAvailableByteCount());
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
runner.test("with empty bytes", (test: Test) =>
|
|
62
|
-
{
|
|
63
|
-
const stream: ByteListStream = ByteListStream.create();
|
|
64
|
-
test.assertEqual(0, stream.writeBytes([]).await());
|
|
65
|
-
test.assertEqual(0, stream.getAvailableByteCount());
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
runner.test("with non-empty bytes", (test: Test) =>
|
|
69
|
-
{
|
|
70
|
-
const stream: ByteListStream = ByteListStream.create();
|
|
71
|
-
|
|
72
|
-
test.assertEqual(4, stream.writeBytes([1, 2, 3, 4]).await());
|
|
73
|
-
test.assertEqual(4, stream.getAvailableByteCount());
|
|
74
|
-
|
|
75
|
-
const bytes: Uint8Array = stream.readBytes(10).await();
|
|
76
|
-
test.assertNotUndefinedAndNotNull(bytes);
|
|
77
|
-
test.assertEqual(4, bytes.length);
|
|
78
|
-
test.assertEqual(new Uint8Array([1, 2, 3, 4]), bytes);
|
|
79
|
-
test.assertEqual(0, stream.getAvailableByteCount());
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
runner.test("with negative startIndex", (test: Test) =>
|
|
83
|
-
{
|
|
84
|
-
const stream: ByteListStream = ByteListStream.create();
|
|
85
|
-
test.assertThrows(() => stream.writeBytes([1, 2], -1), new PreConditionError(
|
|
86
|
-
"Expression: startIndex",
|
|
87
|
-
"Expected: between 0 and 2",
|
|
88
|
-
"Actual: -1",
|
|
89
|
-
));
|
|
90
|
-
test.assertEqual(0, stream.getAvailableByteCount());
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
runner.test("with too large startIndex", (test: Test) =>
|
|
94
|
-
{
|
|
95
|
-
const stream: ByteListStream = ByteListStream.create();
|
|
96
|
-
test.assertThrows(() => stream.writeBytes([1, 2], 3), new PreConditionError(
|
|
97
|
-
"Expression: startIndex",
|
|
98
|
-
"Expected: between 0 and 2",
|
|
99
|
-
"Actual: 3",
|
|
100
|
-
));
|
|
101
|
-
test.assertEqual(0, stream.getAvailableByteCount());
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
runner.test("with valid non-zero startIndex", (test: Test) =>
|
|
105
|
-
{
|
|
106
|
-
const stream: ByteListStream = ByteListStream.create();
|
|
107
|
-
const writeBytesResult: number = stream.writeBytes([1, 2], 1).await();
|
|
108
|
-
test.assertEqual(1, writeBytesResult);
|
|
109
|
-
test.assertEqual(1, stream.getAvailableByteCount());
|
|
110
|
-
|
|
111
|
-
test.assertEqual(new Uint8Array([2]), stream.readBytes(5).await());
|
|
112
|
-
test.assertEqual(0, stream.getAvailableByteCount());
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
runner.test("with startIndex equal to bytes length", (test: Test) =>
|
|
116
|
-
{
|
|
117
|
-
const stream: ByteListStream = ByteListStream.create();
|
|
118
|
-
const writeBytesResult: number = stream.writeBytes([1, 2], 2).await();
|
|
119
|
-
test.assertEqual(0, writeBytesResult);
|
|
120
|
-
test.assertEqual(0, stream.getAvailableByteCount());
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
runner.test("with negative length", (test: Test) =>
|
|
124
|
-
{
|
|
125
|
-
const stream: ByteListStream = ByteListStream.create();
|
|
126
|
-
test.assertThrows(() => stream.writeBytes([1, 2], 0, -1), new PreConditionError(
|
|
127
|
-
"Expression: length",
|
|
128
|
-
"Expected: between 0 and 2",
|
|
129
|
-
"Actual: -1",
|
|
130
|
-
));
|
|
131
|
-
test.assertEqual(0, stream.getAvailableByteCount());
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
runner.test("with too large length", (test: Test) =>
|
|
135
|
-
{
|
|
136
|
-
const stream: ByteListStream = ByteListStream.create();
|
|
137
|
-
test.assertThrows(() => stream.writeBytes([1, 2], 0, 3), new PreConditionError(
|
|
138
|
-
"Expression: length",
|
|
139
|
-
"Expected: between 0 and 2",
|
|
140
|
-
"Actual: 3",
|
|
141
|
-
));
|
|
142
|
-
test.assertEqual(0, stream.getAvailableByteCount());
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
runner.test("with valid startIndex and length values", (test: Test) =>
|
|
146
|
-
{
|
|
147
|
-
const stream: ByteListStream = ByteListStream.create();
|
|
148
|
-
const writeBytesResult: number = stream.writeBytes([1, 2, 3, 4, 5], 2, 2).await();
|
|
149
|
-
test.assertEqual(2, writeBytesResult);
|
|
150
|
-
test.assertEqual(2, stream.getAvailableByteCount());
|
|
151
|
-
|
|
152
|
-
test.assertEqual(new Uint8Array([3, 4]), stream.readBytes(50).await());
|
|
153
|
-
test.assertEqual(0, stream.getAvailableByteCount());
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
runner.testFunction("readBytes()", () =>
|
|
158
|
-
{
|
|
159
|
-
runner.testGroup("with empty stream", () =>
|
|
160
|
-
{
|
|
161
|
-
runner.test("with negative count", (test: Test) =>
|
|
162
|
-
{
|
|
163
|
-
const stream: ByteListStream = ByteListStream.create();
|
|
164
|
-
test.assertThrows(() => stream.readBytes(-1).await(), new PreConditionError(
|
|
165
|
-
"Expression: count",
|
|
166
|
-
"Expected: greater than or equal to 0",
|
|
167
|
-
"Actual: -1",
|
|
168
|
-
));
|
|
169
|
-
test.assertEqual(0, stream.getAvailableByteCount());
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
runner.test("with zero count", (test: Test) =>
|
|
173
|
-
{
|
|
174
|
-
const stream: ByteListStream = ByteListStream.create();
|
|
175
|
-
test.assertThrows(() => stream.readBytes(0).await(), new EmptyError());
|
|
176
|
-
test.assertEqual(0, stream.getAvailableByteCount());
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
runner.test("with positive count", (test: Test) =>
|
|
180
|
-
{
|
|
181
|
-
const stream: ByteListStream = ByteListStream.create();
|
|
182
|
-
test.assertThrows(() => stream.readBytes(1).await(), new EmptyError());
|
|
183
|
-
test.assertEqual(0, stream.getAvailableByteCount());
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
runner.testGroup("with non-empty stream", () =>
|
|
188
|
-
{
|
|
189
|
-
runner.test("with negative count", (test: Test) =>
|
|
190
|
-
{
|
|
191
|
-
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
192
|
-
test.assertThrows(() => stream.readBytes(-1).await(), new PreConditionError(
|
|
193
|
-
"Expression: count",
|
|
194
|
-
"Expected: greater than or equal to 0",
|
|
195
|
-
"Actual: -1",
|
|
196
|
-
));
|
|
197
|
-
test.assertEqual(3, stream.getAvailableByteCount());
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
runner.test("with zero count", (test: Test) =>
|
|
201
|
-
{
|
|
202
|
-
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
203
|
-
const readBytesResult: Uint8Array = stream.readBytes(0).await();
|
|
204
|
-
test.assertEqual(new Uint8Array(), readBytesResult);
|
|
205
|
-
test.assertEqual(3, stream.getAvailableByteCount());
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
runner.test("with positive count less than bytes available", (test: Test) =>
|
|
209
|
-
{
|
|
210
|
-
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
211
|
-
const readBytesResult: Uint8Array = stream.readBytes(2).await();
|
|
212
|
-
test.assertEqual(new Uint8Array([1, 2]), readBytesResult);
|
|
213
|
-
test.assertEqual(1, stream.getAvailableByteCount());
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
runner.test("with positive count equal to bytes available", (test: Test) =>
|
|
217
|
-
{
|
|
218
|
-
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
219
|
-
const readBytesResult: Uint8Array = stream.readBytes(3).await();
|
|
220
|
-
test.assertEqual(new Uint8Array([1, 2, 3]), readBytesResult);
|
|
221
|
-
test.assertEqual(0, stream.getAvailableByteCount());
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
runner.test("with positive count greater than bytes available", (test: Test) =>
|
|
225
|
-
{
|
|
226
|
-
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
227
|
-
const readBytesResult: Uint8Array = stream.readBytes(4).await();
|
|
228
|
-
test.assertEqual(new Uint8Array([1, 2, 3]), readBytesResult);
|
|
229
|
-
test.assertEqual(0, stream.getAvailableByteCount());
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
runner.test("with undefined output", (test: Test) =>
|
|
233
|
-
{
|
|
234
|
-
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
235
|
-
test.assertThrows(() => stream.readBytes(undefined!), new PreConditionError(
|
|
236
|
-
"Expression: output",
|
|
237
|
-
"Expected: not undefined and not null",
|
|
238
|
-
"Actual: undefined",
|
|
239
|
-
));
|
|
240
|
-
test.assertEqual(3, stream.getAvailableByteCount());
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
runner.test("with null output", (test: Test) =>
|
|
244
|
-
{
|
|
245
|
-
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
246
|
-
test.assertThrows(() => stream.readBytes(null!), new PreConditionError(
|
|
247
|
-
"Expression: output",
|
|
248
|
-
"Expected: not undefined and not null",
|
|
249
|
-
"Actual: null",
|
|
250
|
-
));
|
|
251
|
-
test.assertEqual(3, stream.getAvailableByteCount());
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
runner.test("with empty output", (test: Test) =>
|
|
255
|
-
{
|
|
256
|
-
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
257
|
-
const output: Uint8Array = new Uint8Array();
|
|
258
|
-
const readBytesResult: number = stream.readBytes(output).await();
|
|
259
|
-
test.assertEqual(0, readBytesResult);
|
|
260
|
-
test.assertEqual(output, new Uint8Array());
|
|
261
|
-
test.assertEqual(3, stream.getAvailableByteCount());
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
runner.test("with output smaller than the available bytes", (test: Test) =>
|
|
265
|
-
{
|
|
266
|
-
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
267
|
-
const output: Uint8Array = new Uint8Array(1);
|
|
268
|
-
const readBytesResult: number = stream.readBytes(output).await();
|
|
269
|
-
test.assertEqual(1, readBytesResult);
|
|
270
|
-
test.assertEqual(output, new Uint8Array([1]));
|
|
271
|
-
test.assertEqual(2, stream.getAvailableByteCount());
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
runner.test("with output equal to the available bytes", (test: Test) =>
|
|
275
|
-
{
|
|
276
|
-
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
277
|
-
const output: Uint8Array = new Uint8Array(3);
|
|
278
|
-
const readBytesResult: number = stream.readBytes(output).await();
|
|
279
|
-
test.assertEqual(3, readBytesResult);
|
|
280
|
-
test.assertEqual(output, new Uint8Array([1, 2, 3]));
|
|
281
|
-
test.assertEqual(0, stream.getAvailableByteCount());
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
runner.test("with output larger than available bytes", (test: Test) =>
|
|
285
|
-
{
|
|
286
|
-
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
287
|
-
const output: Uint8Array = new Uint8Array(5);
|
|
288
|
-
const readBytesResult: number = stream.readBytes(output).await();
|
|
289
|
-
test.assertEqual(3, readBytesResult);
|
|
290
|
-
test.assertEqual(output, new Uint8Array([1, 2, 3, 0, 0]));
|
|
291
|
-
test.assertEqual(0, stream.getAvailableByteCount());
|
|
292
|
-
});
|
|
293
|
-
|
|
294
|
-
runner.test("with negative startIndex", (test: Test) =>
|
|
295
|
-
{
|
|
296
|
-
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
297
|
-
const output: Uint8Array = new Uint8Array(5);
|
|
298
|
-
test.assertThrows(() => stream.readBytes(output, -1), new PreConditionError(
|
|
299
|
-
"Expression: startIndex",
|
|
300
|
-
"Expected: between 0 and 5",
|
|
301
|
-
"Actual: -1",
|
|
302
|
-
));
|
|
303
|
-
test.assertEqual(3, stream.getAvailableByteCount());
|
|
304
|
-
});
|
|
305
|
-
|
|
306
|
-
runner.test("with too large startIndex", (test: Test) =>
|
|
307
|
-
{
|
|
308
|
-
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
309
|
-
const output: Uint8Array = new Uint8Array(5);
|
|
310
|
-
test.assertThrows(() => stream.readBytes(output, 6), new PreConditionError(
|
|
311
|
-
"Expression: startIndex",
|
|
312
|
-
"Expected: between 0 and 5",
|
|
313
|
-
"Actual: 6",
|
|
314
|
-
));
|
|
315
|
-
test.assertEqual(3, stream.getAvailableByteCount());
|
|
316
|
-
});
|
|
317
|
-
|
|
318
|
-
runner.test("with startIndex with enough space to read the entire stream", (test: Test) =>
|
|
319
|
-
{
|
|
320
|
-
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
321
|
-
const output: Uint8Array = new Uint8Array(5);
|
|
322
|
-
test.assertEqual(3, stream.readBytes(output, 2).await());
|
|
323
|
-
test.assertEqual(new Uint8Array([0, 0, 1, 2, 3]), output);
|
|
324
|
-
test.assertEqual(0, stream.getAvailableByteCount());
|
|
325
|
-
});
|
|
326
|
-
|
|
327
|
-
runner.test("with startIndex with not enough space to read the entire stream", (test: Test) =>
|
|
328
|
-
{
|
|
329
|
-
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
330
|
-
const output: Uint8Array = new Uint8Array(5);
|
|
331
|
-
test.assertEqual(2, stream.readBytes(output, 3).await());
|
|
332
|
-
test.assertEqual(new Uint8Array([0, 0, 0, 1, 2]), output);
|
|
333
|
-
test.assertEqual(1, stream.getAvailableByteCount());
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
runner.test("with startIndex equal to output length", (test: Test) =>
|
|
337
|
-
{
|
|
338
|
-
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
339
|
-
const output: Uint8Array = new Uint8Array(5);
|
|
340
|
-
test.assertEqual(0, stream.readBytes(output, 5).await());
|
|
341
|
-
test.assertEqual(new Uint8Array(5), output);
|
|
342
|
-
test.assertEqual(3, stream.getAvailableByteCount());
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
runner.test("with negative count", (test: Test) =>
|
|
346
|
-
{
|
|
347
|
-
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
348
|
-
const output: Uint8Array = new Uint8Array(5);
|
|
349
|
-
test.assertThrows(() => stream.readBytes(output, 1, -1), new PreConditionError(
|
|
350
|
-
"Expression: count",
|
|
351
|
-
"Expected: between 0 and 4",
|
|
352
|
-
"Actual: -1",
|
|
353
|
-
));
|
|
354
|
-
test.assertEqual(3, stream.getAvailableByteCount());
|
|
355
|
-
});
|
|
356
|
-
|
|
357
|
-
runner.test("with count larger than output.length - startIndex", (test: Test) =>
|
|
358
|
-
{
|
|
359
|
-
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
360
|
-
const output: Uint8Array = new Uint8Array(5);
|
|
361
|
-
test.assertThrows(() => stream.readBytes(output, 1, 5), new PreConditionError(
|
|
362
|
-
"Expression: count",
|
|
363
|
-
"Expected: between 0 and 4",
|
|
364
|
-
"Actual: 5",
|
|
365
|
-
));
|
|
366
|
-
test.assertEqual(3, stream.getAvailableByteCount());
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
runner.test("with startIndex with enough space to read the entire stream", (test: Test) =>
|
|
370
|
-
{
|
|
371
|
-
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
372
|
-
const output: Uint8Array = new Uint8Array(5);
|
|
373
|
-
test.assertEqual(3, stream.readBytes(output, 2, 3).await());
|
|
374
|
-
test.assertEqual(new Uint8Array([0, 0, 1, 2, 3]), output);
|
|
375
|
-
test.assertEqual(0, stream.getAvailableByteCount());
|
|
376
|
-
});
|
|
377
|
-
|
|
378
|
-
runner.test("with startIndex with not enough space to read the entire stream", (test: Test) =>
|
|
379
|
-
{
|
|
380
|
-
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
381
|
-
const output: Uint8Array = new Uint8Array(5);
|
|
382
|
-
test.assertEqual(1, stream.readBytes(output, 3, 1).await());
|
|
383
|
-
test.assertEqual(new Uint8Array([0, 0, 0, 1, 0]), output);
|
|
384
|
-
test.assertEqual(2, stream.getAvailableByteCount());
|
|
385
|
-
});
|
|
386
|
-
});
|
|
387
|
-
});
|
|
388
|
-
});
|
|
389
|
-
});
|
|
1
|
+
import { ByteListStream } from "../sources/byteListStream";
|
|
2
|
+
import { EmptyError } from "../sources/emptyError";
|
|
3
|
+
import { PreConditionError } from "../sources/preConditionError";
|
|
4
|
+
import { Test } from "./test";
|
|
5
|
+
import { TestRunner } from "./testRunner";
|
|
6
|
+
|
|
7
|
+
export function test(runner: TestRunner): void
|
|
8
|
+
{
|
|
9
|
+
runner.testFile("byteListStream.ts", () =>
|
|
10
|
+
{
|
|
11
|
+
runner.testType("ByteListStream", () =>
|
|
12
|
+
{
|
|
13
|
+
runner.testFunction("create()", () =>
|
|
14
|
+
{
|
|
15
|
+
runner.test("with no arguments", (test: Test) =>
|
|
16
|
+
{
|
|
17
|
+
const stream: ByteListStream = ByteListStream.create();
|
|
18
|
+
test.assertNotUndefinedAndNotNull(stream);
|
|
19
|
+
test.assertEqual(0, stream.getAvailableByteCount());
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
runner.test("with empty array", (test: Test) =>
|
|
23
|
+
{
|
|
24
|
+
const stream: ByteListStream = ByteListStream.create([]);
|
|
25
|
+
test.assertNotUndefinedAndNotNull(stream);
|
|
26
|
+
test.assertEqual(0, stream.getAvailableByteCount());
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
runner.test("with non-empty array", (test: Test) =>
|
|
30
|
+
{
|
|
31
|
+
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
32
|
+
test.assertNotUndefinedAndNotNull(stream);
|
|
33
|
+
test.assertEqual(3, stream.getAvailableByteCount());
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
runner.testFunction("writeBytes()", () =>
|
|
38
|
+
{
|
|
39
|
+
runner.test("with undefined bytes", (test: Test) =>
|
|
40
|
+
{
|
|
41
|
+
const stream: ByteListStream = ByteListStream.create();
|
|
42
|
+
test.assertThrows(() => stream.writeBytes(undefined!), new PreConditionError(
|
|
43
|
+
"Expression: bytes",
|
|
44
|
+
"Expected: not undefined and not null",
|
|
45
|
+
"Actual: undefined",
|
|
46
|
+
));
|
|
47
|
+
test.assertEqual(0, stream.getAvailableByteCount());
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
runner.test("with null bytes", (test: Test) =>
|
|
51
|
+
{
|
|
52
|
+
const stream: ByteListStream = ByteListStream.create();
|
|
53
|
+
test.assertThrows(() => stream.writeBytes(null!), new PreConditionError(
|
|
54
|
+
"Expression: bytes",
|
|
55
|
+
"Expected: not undefined and not null",
|
|
56
|
+
"Actual: null",
|
|
57
|
+
));
|
|
58
|
+
test.assertEqual(0, stream.getAvailableByteCount());
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
runner.test("with empty bytes", (test: Test) =>
|
|
62
|
+
{
|
|
63
|
+
const stream: ByteListStream = ByteListStream.create();
|
|
64
|
+
test.assertEqual(0, stream.writeBytes([]).await());
|
|
65
|
+
test.assertEqual(0, stream.getAvailableByteCount());
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
runner.test("with non-empty bytes", (test: Test) =>
|
|
69
|
+
{
|
|
70
|
+
const stream: ByteListStream = ByteListStream.create();
|
|
71
|
+
|
|
72
|
+
test.assertEqual(4, stream.writeBytes([1, 2, 3, 4]).await());
|
|
73
|
+
test.assertEqual(4, stream.getAvailableByteCount());
|
|
74
|
+
|
|
75
|
+
const bytes: Uint8Array = stream.readBytes(10).await();
|
|
76
|
+
test.assertNotUndefinedAndNotNull(bytes);
|
|
77
|
+
test.assertEqual(4, bytes.length);
|
|
78
|
+
test.assertEqual(new Uint8Array([1, 2, 3, 4]), bytes);
|
|
79
|
+
test.assertEqual(0, stream.getAvailableByteCount());
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
runner.test("with negative startIndex", (test: Test) =>
|
|
83
|
+
{
|
|
84
|
+
const stream: ByteListStream = ByteListStream.create();
|
|
85
|
+
test.assertThrows(() => stream.writeBytes([1, 2], -1), new PreConditionError(
|
|
86
|
+
"Expression: startIndex",
|
|
87
|
+
"Expected: between 0 and 2",
|
|
88
|
+
"Actual: -1",
|
|
89
|
+
));
|
|
90
|
+
test.assertEqual(0, stream.getAvailableByteCount());
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
runner.test("with too large startIndex", (test: Test) =>
|
|
94
|
+
{
|
|
95
|
+
const stream: ByteListStream = ByteListStream.create();
|
|
96
|
+
test.assertThrows(() => stream.writeBytes([1, 2], 3), new PreConditionError(
|
|
97
|
+
"Expression: startIndex",
|
|
98
|
+
"Expected: between 0 and 2",
|
|
99
|
+
"Actual: 3",
|
|
100
|
+
));
|
|
101
|
+
test.assertEqual(0, stream.getAvailableByteCount());
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
runner.test("with valid non-zero startIndex", (test: Test) =>
|
|
105
|
+
{
|
|
106
|
+
const stream: ByteListStream = ByteListStream.create();
|
|
107
|
+
const writeBytesResult: number = stream.writeBytes([1, 2], 1).await();
|
|
108
|
+
test.assertEqual(1, writeBytesResult);
|
|
109
|
+
test.assertEqual(1, stream.getAvailableByteCount());
|
|
110
|
+
|
|
111
|
+
test.assertEqual(new Uint8Array([2]), stream.readBytes(5).await());
|
|
112
|
+
test.assertEqual(0, stream.getAvailableByteCount());
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
runner.test("with startIndex equal to bytes length", (test: Test) =>
|
|
116
|
+
{
|
|
117
|
+
const stream: ByteListStream = ByteListStream.create();
|
|
118
|
+
const writeBytesResult: number = stream.writeBytes([1, 2], 2).await();
|
|
119
|
+
test.assertEqual(0, writeBytesResult);
|
|
120
|
+
test.assertEqual(0, stream.getAvailableByteCount());
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
runner.test("with negative length", (test: Test) =>
|
|
124
|
+
{
|
|
125
|
+
const stream: ByteListStream = ByteListStream.create();
|
|
126
|
+
test.assertThrows(() => stream.writeBytes([1, 2], 0, -1), new PreConditionError(
|
|
127
|
+
"Expression: length",
|
|
128
|
+
"Expected: between 0 and 2",
|
|
129
|
+
"Actual: -1",
|
|
130
|
+
));
|
|
131
|
+
test.assertEqual(0, stream.getAvailableByteCount());
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
runner.test("with too large length", (test: Test) =>
|
|
135
|
+
{
|
|
136
|
+
const stream: ByteListStream = ByteListStream.create();
|
|
137
|
+
test.assertThrows(() => stream.writeBytes([1, 2], 0, 3), new PreConditionError(
|
|
138
|
+
"Expression: length",
|
|
139
|
+
"Expected: between 0 and 2",
|
|
140
|
+
"Actual: 3",
|
|
141
|
+
));
|
|
142
|
+
test.assertEqual(0, stream.getAvailableByteCount());
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
runner.test("with valid startIndex and length values", (test: Test) =>
|
|
146
|
+
{
|
|
147
|
+
const stream: ByteListStream = ByteListStream.create();
|
|
148
|
+
const writeBytesResult: number = stream.writeBytes([1, 2, 3, 4, 5], 2, 2).await();
|
|
149
|
+
test.assertEqual(2, writeBytesResult);
|
|
150
|
+
test.assertEqual(2, stream.getAvailableByteCount());
|
|
151
|
+
|
|
152
|
+
test.assertEqual(new Uint8Array([3, 4]), stream.readBytes(50).await());
|
|
153
|
+
test.assertEqual(0, stream.getAvailableByteCount());
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
runner.testFunction("readBytes()", () =>
|
|
158
|
+
{
|
|
159
|
+
runner.testGroup("with empty stream", () =>
|
|
160
|
+
{
|
|
161
|
+
runner.test("with negative count", (test: Test) =>
|
|
162
|
+
{
|
|
163
|
+
const stream: ByteListStream = ByteListStream.create();
|
|
164
|
+
test.assertThrows(() => stream.readBytes(-1).await(), new PreConditionError(
|
|
165
|
+
"Expression: count",
|
|
166
|
+
"Expected: greater than or equal to 0",
|
|
167
|
+
"Actual: -1",
|
|
168
|
+
));
|
|
169
|
+
test.assertEqual(0, stream.getAvailableByteCount());
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
runner.test("with zero count", (test: Test) =>
|
|
173
|
+
{
|
|
174
|
+
const stream: ByteListStream = ByteListStream.create();
|
|
175
|
+
test.assertThrows(() => stream.readBytes(0).await(), new EmptyError());
|
|
176
|
+
test.assertEqual(0, stream.getAvailableByteCount());
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
runner.test("with positive count", (test: Test) =>
|
|
180
|
+
{
|
|
181
|
+
const stream: ByteListStream = ByteListStream.create();
|
|
182
|
+
test.assertThrows(() => stream.readBytes(1).await(), new EmptyError());
|
|
183
|
+
test.assertEqual(0, stream.getAvailableByteCount());
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
runner.testGroup("with non-empty stream", () =>
|
|
188
|
+
{
|
|
189
|
+
runner.test("with negative count", (test: Test) =>
|
|
190
|
+
{
|
|
191
|
+
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
192
|
+
test.assertThrows(() => stream.readBytes(-1).await(), new PreConditionError(
|
|
193
|
+
"Expression: count",
|
|
194
|
+
"Expected: greater than or equal to 0",
|
|
195
|
+
"Actual: -1",
|
|
196
|
+
));
|
|
197
|
+
test.assertEqual(3, stream.getAvailableByteCount());
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
runner.test("with zero count", (test: Test) =>
|
|
201
|
+
{
|
|
202
|
+
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
203
|
+
const readBytesResult: Uint8Array = stream.readBytes(0).await();
|
|
204
|
+
test.assertEqual(new Uint8Array(), readBytesResult);
|
|
205
|
+
test.assertEqual(3, stream.getAvailableByteCount());
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
runner.test("with positive count less than bytes available", (test: Test) =>
|
|
209
|
+
{
|
|
210
|
+
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
211
|
+
const readBytesResult: Uint8Array = stream.readBytes(2).await();
|
|
212
|
+
test.assertEqual(new Uint8Array([1, 2]), readBytesResult);
|
|
213
|
+
test.assertEqual(1, stream.getAvailableByteCount());
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
runner.test("with positive count equal to bytes available", (test: Test) =>
|
|
217
|
+
{
|
|
218
|
+
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
219
|
+
const readBytesResult: Uint8Array = stream.readBytes(3).await();
|
|
220
|
+
test.assertEqual(new Uint8Array([1, 2, 3]), readBytesResult);
|
|
221
|
+
test.assertEqual(0, stream.getAvailableByteCount());
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
runner.test("with positive count greater than bytes available", (test: Test) =>
|
|
225
|
+
{
|
|
226
|
+
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
227
|
+
const readBytesResult: Uint8Array = stream.readBytes(4).await();
|
|
228
|
+
test.assertEqual(new Uint8Array([1, 2, 3]), readBytesResult);
|
|
229
|
+
test.assertEqual(0, stream.getAvailableByteCount());
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
runner.test("with undefined output", (test: Test) =>
|
|
233
|
+
{
|
|
234
|
+
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
235
|
+
test.assertThrows(() => stream.readBytes(undefined!), new PreConditionError(
|
|
236
|
+
"Expression: output",
|
|
237
|
+
"Expected: not undefined and not null",
|
|
238
|
+
"Actual: undefined",
|
|
239
|
+
));
|
|
240
|
+
test.assertEqual(3, stream.getAvailableByteCount());
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
runner.test("with null output", (test: Test) =>
|
|
244
|
+
{
|
|
245
|
+
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
246
|
+
test.assertThrows(() => stream.readBytes(null!), new PreConditionError(
|
|
247
|
+
"Expression: output",
|
|
248
|
+
"Expected: not undefined and not null",
|
|
249
|
+
"Actual: null",
|
|
250
|
+
));
|
|
251
|
+
test.assertEqual(3, stream.getAvailableByteCount());
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
runner.test("with empty output", (test: Test) =>
|
|
255
|
+
{
|
|
256
|
+
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
257
|
+
const output: Uint8Array = new Uint8Array();
|
|
258
|
+
const readBytesResult: number = stream.readBytes(output).await();
|
|
259
|
+
test.assertEqual(0, readBytesResult);
|
|
260
|
+
test.assertEqual(output, new Uint8Array());
|
|
261
|
+
test.assertEqual(3, stream.getAvailableByteCount());
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
runner.test("with output smaller than the available bytes", (test: Test) =>
|
|
265
|
+
{
|
|
266
|
+
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
267
|
+
const output: Uint8Array = new Uint8Array(1);
|
|
268
|
+
const readBytesResult: number = stream.readBytes(output).await();
|
|
269
|
+
test.assertEqual(1, readBytesResult);
|
|
270
|
+
test.assertEqual(output, new Uint8Array([1]));
|
|
271
|
+
test.assertEqual(2, stream.getAvailableByteCount());
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
runner.test("with output equal to the available bytes", (test: Test) =>
|
|
275
|
+
{
|
|
276
|
+
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
277
|
+
const output: Uint8Array = new Uint8Array(3);
|
|
278
|
+
const readBytesResult: number = stream.readBytes(output).await();
|
|
279
|
+
test.assertEqual(3, readBytesResult);
|
|
280
|
+
test.assertEqual(output, new Uint8Array([1, 2, 3]));
|
|
281
|
+
test.assertEqual(0, stream.getAvailableByteCount());
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
runner.test("with output larger than available bytes", (test: Test) =>
|
|
285
|
+
{
|
|
286
|
+
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
287
|
+
const output: Uint8Array = new Uint8Array(5);
|
|
288
|
+
const readBytesResult: number = stream.readBytes(output).await();
|
|
289
|
+
test.assertEqual(3, readBytesResult);
|
|
290
|
+
test.assertEqual(output, new Uint8Array([1, 2, 3, 0, 0]));
|
|
291
|
+
test.assertEqual(0, stream.getAvailableByteCount());
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
runner.test("with negative startIndex", (test: Test) =>
|
|
295
|
+
{
|
|
296
|
+
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
297
|
+
const output: Uint8Array = new Uint8Array(5);
|
|
298
|
+
test.assertThrows(() => stream.readBytes(output, -1), new PreConditionError(
|
|
299
|
+
"Expression: startIndex",
|
|
300
|
+
"Expected: between 0 and 5",
|
|
301
|
+
"Actual: -1",
|
|
302
|
+
));
|
|
303
|
+
test.assertEqual(3, stream.getAvailableByteCount());
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
runner.test("with too large startIndex", (test: Test) =>
|
|
307
|
+
{
|
|
308
|
+
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
309
|
+
const output: Uint8Array = new Uint8Array(5);
|
|
310
|
+
test.assertThrows(() => stream.readBytes(output, 6), new PreConditionError(
|
|
311
|
+
"Expression: startIndex",
|
|
312
|
+
"Expected: between 0 and 5",
|
|
313
|
+
"Actual: 6",
|
|
314
|
+
));
|
|
315
|
+
test.assertEqual(3, stream.getAvailableByteCount());
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
runner.test("with startIndex with enough space to read the entire stream", (test: Test) =>
|
|
319
|
+
{
|
|
320
|
+
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
321
|
+
const output: Uint8Array = new Uint8Array(5);
|
|
322
|
+
test.assertEqual(3, stream.readBytes(output, 2).await());
|
|
323
|
+
test.assertEqual(new Uint8Array([0, 0, 1, 2, 3]), output);
|
|
324
|
+
test.assertEqual(0, stream.getAvailableByteCount());
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
runner.test("with startIndex with not enough space to read the entire stream", (test: Test) =>
|
|
328
|
+
{
|
|
329
|
+
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
330
|
+
const output: Uint8Array = new Uint8Array(5);
|
|
331
|
+
test.assertEqual(2, stream.readBytes(output, 3).await());
|
|
332
|
+
test.assertEqual(new Uint8Array([0, 0, 0, 1, 2]), output);
|
|
333
|
+
test.assertEqual(1, stream.getAvailableByteCount());
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
runner.test("with startIndex equal to output length", (test: Test) =>
|
|
337
|
+
{
|
|
338
|
+
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
339
|
+
const output: Uint8Array = new Uint8Array(5);
|
|
340
|
+
test.assertEqual(0, stream.readBytes(output, 5).await());
|
|
341
|
+
test.assertEqual(new Uint8Array(5), output);
|
|
342
|
+
test.assertEqual(3, stream.getAvailableByteCount());
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
runner.test("with negative count", (test: Test) =>
|
|
346
|
+
{
|
|
347
|
+
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
348
|
+
const output: Uint8Array = new Uint8Array(5);
|
|
349
|
+
test.assertThrows(() => stream.readBytes(output, 1, -1), new PreConditionError(
|
|
350
|
+
"Expression: count",
|
|
351
|
+
"Expected: between 0 and 4",
|
|
352
|
+
"Actual: -1",
|
|
353
|
+
));
|
|
354
|
+
test.assertEqual(3, stream.getAvailableByteCount());
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
runner.test("with count larger than output.length - startIndex", (test: Test) =>
|
|
358
|
+
{
|
|
359
|
+
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
360
|
+
const output: Uint8Array = new Uint8Array(5);
|
|
361
|
+
test.assertThrows(() => stream.readBytes(output, 1, 5), new PreConditionError(
|
|
362
|
+
"Expression: count",
|
|
363
|
+
"Expected: between 0 and 4",
|
|
364
|
+
"Actual: 5",
|
|
365
|
+
));
|
|
366
|
+
test.assertEqual(3, stream.getAvailableByteCount());
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
runner.test("with startIndex with enough space to read the entire stream", (test: Test) =>
|
|
370
|
+
{
|
|
371
|
+
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
372
|
+
const output: Uint8Array = new Uint8Array(5);
|
|
373
|
+
test.assertEqual(3, stream.readBytes(output, 2, 3).await());
|
|
374
|
+
test.assertEqual(new Uint8Array([0, 0, 1, 2, 3]), output);
|
|
375
|
+
test.assertEqual(0, stream.getAvailableByteCount());
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
runner.test("with startIndex with not enough space to read the entire stream", (test: Test) =>
|
|
379
|
+
{
|
|
380
|
+
const stream: ByteListStream = ByteListStream.create([1, 2, 3]);
|
|
381
|
+
const output: Uint8Array = new Uint8Array(5);
|
|
382
|
+
test.assertEqual(1, stream.readBytes(output, 3, 1).await());
|
|
383
|
+
test.assertEqual(new Uint8Array([0, 0, 0, 1, 0]), output);
|
|
384
|
+
test.assertEqual(2, stream.getAvailableByteCount());
|
|
385
|
+
});
|
|
386
|
+
});
|
|
387
|
+
});
|
|
388
|
+
});
|
|
389
|
+
});
|
|
390
390
|
}
|