(size)
| 15 | |
| 16 | // Generate a predictable test payload |
| 17 | function generateTestData(size) { |
| 18 | const buf = Buffer.alloc(size); |
| 19 | // Fill with a repeating pattern that's easy to verify |
| 20 | // Pattern: 4-byte sequence number (big-endian) repeated |
| 21 | for (let i = 0; i < size; i += 4) { |
| 22 | const remaining = Math.min(4, size - i); |
| 23 | const seqNum = Math.floor(i / 4); |
| 24 | buf.writeUInt32BE(seqNum, i); |
| 25 | } |
| 26 | return buf; |
| 27 | } |
| 28 | |
| 29 | // Verify the test data is intact |
| 30 | function verifyTestData(buf) { |