MCPcopy Create free account
hub / github.com/deepclause/agentvm / verifyTestData

Function verifyTestData

test/data-integrity.test.js:30–55  ·  view source on GitHub ↗
(buf)

Source from the content-addressed store, hash-verified

28
29// Verify the test data is intact
30function verifyTestData(buf) {
31 const errors = [];
32 for (let i = 0; i < buf.length; i += 4) {
33 const remaining = Math.min(4, buf.length - i);
34 if (remaining < 4) break; // Ignore partial last chunk
35
36 const expected = Math.floor(i / 4);
37 const actual = buf.readUInt32BE(i);
38
39 if (actual !== expected) {
40 errors.push({
41 offset: i,
42 expected,
43 actual,
44 // Get surrounding context
45 context: buf.slice(Math.max(0, i - 8), Math.min(buf.length, i + 12)).toString('hex')
46 });
47
48 if (errors.length >= 10) {
49 errors.push({ message: '... more errors truncated ...' });
50 break;
51 }
52 }
53 }
54 return errors;
55}
56
57async function runTest() {
58 const TEST_SIZE = 64 * 1024; // 64KB - enough to span multiple TCP segments

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected