(buf)
| 28 | |
| 29 | // Verify the test data is intact |
| 30 | function 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 | |
| 57 | async function runTest() { |
| 58 | const TEST_SIZE = 64 * 1024; // 64KB - enough to span multiple TCP segments |
nothing calls this directly
no outgoing calls
no test coverage detected