Skip to content

Commit

Permalink
Ensure byteOffset is respected
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderOMara committed Nov 20, 2024
1 parent 768599b commit f51f563
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions macro.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ Deno.test('endianSwap', () => {
Deno.test('assignView', () => {
const src = new Uint8Array([0xff, 0xfe, 0xfd, 0xfc]);
const dst = new Int8Array(src.length);
assignView(dst, src);
assertEquals(dst, new Int8Array([-1, -2, -3, -4]));
assignView(dst.subarray(1, 3), src.subarray(2, 4));
assertEquals(dst, new Int8Array([0, -3, -4, 0]));
assertThrows(() => assignView(dst, src.slice(1)), RangeError);
});

Expand Down Expand Up @@ -85,21 +85,21 @@ Deno.test('assignStruct', () => {
}

{
const src = new Test(new ArrayBuffer(Test.BYTE_LENGTH));
const src = new Test(new ArrayBuffer(Test.BYTE_LENGTH + 1), 1);
src.alpha = 65;
src.beta = 66;
const dst = new Test(new ArrayBuffer(Test.BYTE_LENGTH));
const dst = new Test(new ArrayBuffer(Test.BYTE_LENGTH + 2), 2);
assignStruct(dst, src);
assertEquals(dst.alpha, 65);
assertEquals(dst.beta, 66);
}

{
const src = new TestExt(new ArrayBuffer(TestExt.BYTE_LENGTH));
const src = new TestExt(new ArrayBuffer(TestExt.BYTE_LENGTH + 1), 1);
src.alpha = 65;
src.beta = 66;
src.gamma = 71;
const dst = new Test(new ArrayBuffer(Test.BYTE_LENGTH));
const dst = new Test(new ArrayBuffer(Test.BYTE_LENGTH + 2), 2);
assignStruct(dst, src);
assertEquals(dst.alpha, 65);
assertEquals(dst.beta, 66);
Expand Down

0 comments on commit f51f563

Please sign in to comment.