MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / applyExpected

Function applyExpected

packages/core/src/binary/__tests__/binary.fuzz.test.ts:52–78  ·  view source on GitHub ↗
(op: WriteOp, expected: number[], reads: SuccessfulRead[])

Source from the content-addressed store, hash-verified

50}
51
52function applyExpected(op: WriteOp, expected: number[], reads: SuccessfulRead[]): void {
53 if (op.kind === "u8") {
54 expected.push(op.value & 0xff);
55 reads.push({ kind: "u8", value: op.value & 0xff });
56 return;
57 }
58 if (op.kind === "u32") {
59 appendLeU32(expected, op.value);
60 reads.push({ kind: "u32", value: op.value >>> 0 });
61 return;
62 }
63 if (op.kind === "i32") {
64 appendLeI32(expected, op.value);
65 reads.push({ kind: "i32", value: op.value | 0 });
66 return;
67 }
68 if (op.kind === "bytes") {
69 expected.push(...op.bytes);
70 reads.push({ kind: "bytes", bytes: op.bytes });
71 return;
72 }
73
74 const before = expected.length;
75 const aligned = (before + 3) & ~3;
76 while (expected.length < aligned) expected.push(0);
77 if (aligned > before) reads.push({ kind: "skip", len: aligned - before });
78}
79
80function applyWriter(writer: BinaryWriter, op: WriteOp): void {
81 if (op.kind === "u8") {

Callers 1

Calls 3

appendLeU32Function · 0.85
appendLeI32Function · 0.85
pushMethod · 0.45

Tested by

no test coverage detected