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

Function randomOp

packages/core/src/binary/__tests__/binary.fuzz.test.ts:20–27  ·  view source on GitHub ↗
(rng: Rng)

Source from the content-addressed store, hash-verified

18 | Readonly<{ kind: "skip"; len: number }>;
19
20function randomOp(rng: Rng): WriteOp {
21 const kind = pick(rng, ["u8", "u32", "i32", "bytes", "pad4"] as const);
22 if (kind === "u8") return { kind, value: rng.u32() };
23 if (kind === "u32") return { kind, value: rng.u32() };
24 if (kind === "i32") return { kind, value: rng.u32() | 0 };
25 if (kind === "pad4") return { kind };
26 return { kind, bytes: rng.bytes(randomInt(rng, 0, 12)) };
27}
28
29function expectedFailure(
30 op: WriteOp,

Callers 1

Calls 3

pickFunction · 0.90
randomIntFunction · 0.90
bytesMethod · 0.80

Tested by

no test coverage detected