(t *testing.T)
| 97 | } |
| 98 | |
| 99 | func TestAppendBytesHeader(t *testing.T) { |
| 100 | szs := []uint32{0, 1, uint32(tint8), uint32(tint16), tuint32, math.MaxUint32} |
| 101 | var buf bytes.Buffer |
| 102 | en := NewWriter(&buf) |
| 103 | |
| 104 | var bts []byte |
| 105 | for _, sz := range szs { |
| 106 | buf.Reset() |
| 107 | en.WriteBytesHeader(sz) |
| 108 | en.Flush() |
| 109 | bts = AppendBytesHeader(bts[0:0], sz) |
| 110 | |
| 111 | if !bytes.Equal(buf.Bytes(), bts) { |
| 112 | t.Errorf("for size %d, encoder wrote %q and append wrote %q", sz, buf.Bytes(), bts) |
| 113 | } |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | func BenchmarkAppendBytesHeader(b *testing.B) { |
| 118 | buf := make([]byte, 0, 9) |
nothing calls this directly
no test coverage detected
searching dependent graphs…