-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
test64.ts
38 lines (27 loc) 路 859 Bytes
/
test64.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { Evt } from "../lib/index.ts";
import { chunksOf } from "../lib/util/genericOperators/chunksOf.ts";
import { same } from "../tools/inDepth/index.ts";
import { assert } from "https://deno.land/x/tsafe@v1.1.1/mod.ts";
{
const evt = new Evt<Uint8Array>();
const acc: Uint8Array[] = [];
evt.$attach(
chunksOf(6),
data => acc.push(data)
);
evt.post(new Uint8Array([1, 2, 3]));
evt.post(new Uint8Array([4, 5, 6, 7]));
evt.post(new Uint8Array([0]));
evt.post(new Uint8Array([1, 2]));
evt.post(new Uint8Array([3, 4]));
evt.post(new Uint8Array([1, 2, 3, 4, 5, 6]));
assert(same(
acc,
[
new Uint8Array([1, 2, 3, 4, 5, 6]),
new Uint8Array([0, 7, 1, 2, 3, 4]),
new Uint8Array([1, 2, 3, 4, 5, 6])
]
));
console.log("PASS");
}