(b *testing.B)
| 48 | } |
| 49 | |
| 50 | func BenchmarkDerserialize(b *testing.B) { |
| 51 | const N = 12000 |
| 52 | buf := make([]byte, N) |
| 53 | rand.Read(buf) |
| 54 | |
| 55 | for i := 0; i < b.N; i++ { |
| 56 | reader := bytes.NewBuffer(buf) |
| 57 | for j := 0; j < N/100; j++ { |
| 58 | serialization.ReadUint16(reader) |
| 59 | serialization.ReadByte(reader) |
| 60 | serialization.ReadUint64(reader) |
| 61 | serialization.ReadVarUint(reader, 0) |
| 62 | serialization.ReadBytes(reader, 20) |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | } |
| 67 | |
| 68 | func TestReadFromNil(t *testing.T) { |
| 69 | s := NewZeroCopySource(nil) |
nothing calls this directly
no test coverage detected