deno.land / std@0.173.0 / io / slice_long_to_bytes_test.ts

slice_long_to_bytes_test.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
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.import { assertEquals } from "../testing/asserts.ts";import { readLong } from "./read_long.ts";import { sliceLongToBytes } from "./slice_long_to_bytes.ts";import { BufReader } from "./buf_reader.ts";import { BinaryReader } from "./_test_common.ts";
Deno.test("testSliceLongToBytes", function () { const arr = sliceLongToBytes(0x1234567890abcdef); const actual = readLong(new BufReader(new BinaryReader(new Uint8Array(arr)))); const expected = readLong( new BufReader( new BinaryReader( new Uint8Array([0x12, 0x34, 0x56, 0x78, 0x90, 0xab, 0xcd, 0xef]), ), ), ); assertEquals(actual, expected);});
Deno.test("testSliceLongToBytes2", function () { const arr = sliceLongToBytes(0x12345678); assertEquals(arr, [0, 0, 0, 0, 0x12, 0x34, 0x56, 0x78]);});
std

Version Info

Tagged at
a year ago