add client receiving base
This commit is contained in:
22
client/tools.test.ts
Normal file
22
client/tools.test.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { expect, test } from "bun:test";
|
||||
import { uint_bytes_to_num, utf8_decode } from "./tools";
|
||||
|
||||
test("parse_uint - 0xFF", () => {
|
||||
expect(uint_bytes_to_num(new Uint8Array([0x0, 0x0, 0x0, 0xFF]))).toBe(0xFF);
|
||||
});
|
||||
|
||||
test("parse_uint - 0xFF00", () => {
|
||||
expect(uint_bytes_to_num(new Uint8Array([0x0, 0x0, 0xFF, 0x0]))).toBe(0xFF00);
|
||||
});
|
||||
|
||||
test("parse_uint - 0xFF0000", () => {
|
||||
expect(uint_bytes_to_num(new Uint8Array([0x0, 0xFF, 0x0, 0x0]))).toBe(0xFF0000);
|
||||
});
|
||||
|
||||
test("parse_uint - 0xFF000000", () => {
|
||||
expect(uint_bytes_to_num(new Uint8Array([0xFF, 0x0, 0x0, 0x0]))).toBe(0xFF000000);
|
||||
});
|
||||
|
||||
test("decode_utf8 - \"test\"", () => {
|
||||
expect(utf8_decode(new Uint8Array([0x74, 0x65, 0x73, 0x74]))).toBe("test");
|
||||
});
|
Reference in New Issue
Block a user