feat(DataView, ConstDataView)

This commit is contained in:
2025-08-04 15:33:12 +03:00
parent 72f6102f0c
commit 504bfbeae8
11 changed files with 179 additions and 37 deletions

View File

@ -1,6 +1,6 @@
import { describe, expect, test } from "vitest";
import { ConstArray, parse, serialize, sizeof, sizeofHead } from "../src";
import { filledDataView, sizedDataView } from ".";
import { expectDataViewEqual, filledDataView, sizedDataView } from ".";
describe(ConstArray.name, () => {
test('serialize, Number', () => {
@ -15,7 +15,7 @@ describe(ConstArray.name, () => {
expect(16).toEqual(dv.byteLength)
serialize(dv, [1, 2], ConstArray(2), Number)
expect(dv).toEqual(expected)
expectDataViewEqual(dv, expected)
})
test('parse, Number', () => {
@ -25,7 +25,7 @@ describe(ConstArray.name, () => {
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
])
const actual = parse(dv, ConstArray(2), Number)
expect(actual).toEqual(expected)
expectDataViewEqual(actual, expected)
})
test('sizeof', () => {