21 lines
503 B
TypeScript
21 lines
503 B
TypeScript
|
import { assert, assertEquals } from "assert";
|
||
|
import { b } from "../helpers.ts";
|
||
|
import { areBytesEqual, chunkBytes } from "../../public/common/bytes.js";
|
||
|
|
||
|
Deno.test("areBytesEqual", () => {
|
||
|
const x = b(1, 2);
|
||
|
const y = b(1, 2, 3);
|
||
|
const z = b(1, 2, 3);
|
||
|
|
||
|
assert(areBytesEqual(x, x));
|
||
|
assert(areBytesEqual(y, z));
|
||
|
assert(!areBytesEqual(x, y));
|
||
|
});
|
||
|
|
||
|
Deno.test("chunkBytes", () => {
|
||
|
assertEquals(
|
||
|
chunkBytes(b(1, 2, 3, 4, 5, 6, 7, 8), 3),
|
||
|
[b(1, 2, 3), b(4, 5, 6), b(7, 8)],
|
||
|
);
|
||
|
});
|