(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestReadMapHeaderBytes(t *testing.T) { |
| 14 | var buf bytes.Buffer |
| 15 | en := NewWriter(&buf) |
| 16 | |
| 17 | tests := []uint32{0, 1, 5, 49082} |
| 18 | |
| 19 | for i, v := range tests { |
| 20 | buf.Reset() |
| 21 | en.WriteMapHeader(v) |
| 22 | en.Flush() |
| 23 | |
| 24 | out, left, err := ReadMapHeaderBytes(buf.Bytes()) |
| 25 | if err != nil { |
| 26 | t.Errorf("test case %d: %s", i, err) |
| 27 | } |
| 28 | |
| 29 | if len(left) != 0 { |
| 30 | t.Errorf("expected 0 bytes left; found %d", len(left)) |
| 31 | } |
| 32 | |
| 33 | if out != v { |
| 34 | t.Errorf("%d in; %d out", v, out) |
| 35 | } |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | func BenchmarkReadMapHeaderBytes(b *testing.B) { |
| 40 | sizes := []uint32{1, 100, tuint16, tuint32} |
nothing calls this directly
no test coverage detected
searching dependent graphs…