(b *testing.B)
| 125 | } |
| 126 | |
| 127 | func BenchmarkTestReadBytesHeader(b *testing.B) { |
| 128 | sizes := []uint32{1, 100, tuint16, tuint32} |
| 129 | buf := make([]byte, 0, 5*len(sizes)) |
| 130 | for _, sz := range sizes { |
| 131 | buf = AppendBytesHeader(buf, sz) |
| 132 | } |
| 133 | b.SetBytes(int64(len(buf) / len(sizes))) |
| 134 | b.ReportAllocs() |
| 135 | b.ResetTimer() |
| 136 | o := buf |
| 137 | for i := 0; i < b.N; i++ { |
| 138 | _, buf, _ = ReadBytesHeader(buf) |
| 139 | if len(buf) == 0 { |
| 140 | buf = o |
| 141 | } |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | func TestReadNilBytes(t *testing.T) { |
| 146 | var buf bytes.Buffer |
nothing calls this directly
no test coverage detected
searching dependent graphs…