(b *testing.B)
| 81 | } |
| 82 | |
| 83 | func BenchmarkReadArrayHeaderBytes(b *testing.B) { |
| 84 | sizes := []uint32{1, 100, tuint16, tuint32} |
| 85 | buf := make([]byte, 0, 5*len(sizes)) |
| 86 | for _, sz := range sizes { |
| 87 | buf = AppendArrayHeader(buf, sz) |
| 88 | } |
| 89 | b.SetBytes(int64(len(buf) / len(sizes))) |
| 90 | b.ReportAllocs() |
| 91 | b.ResetTimer() |
| 92 | o := buf |
| 93 | for i := 0; i < b.N; i++ { |
| 94 | _, buf, _ = ReadArrayHeaderBytes(buf) |
| 95 | if len(buf) == 0 { |
| 96 | buf = o |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | func TestReadBytesHeader(t *testing.T) { |
| 102 | var buf bytes.Buffer |
nothing calls this directly
no test coverage detected
searching dependent graphs…