(t *testing.T)
| 130 | } |
| 131 | |
| 132 | func TestAppendAndWriteCompatibility(t *testing.T) { |
| 133 | var bts []byte |
| 134 | var buf bytes.Buffer |
| 135 | en := NewWriter(&buf) |
| 136 | |
| 137 | for range 24 { |
| 138 | buf.Reset() |
| 139 | e := randomExt() |
| 140 | bts, _ = AppendExtension(bts[0:0], &e) |
| 141 | en.WriteExtension(&e) |
| 142 | en.Flush() |
| 143 | |
| 144 | if !bytes.Equal(buf.Bytes(), bts) { |
| 145 | t.Errorf("the outputs are different:\n\t%x\n\t%x", buf.Bytes(), bts) |
| 146 | } |
| 147 | |
| 148 | _, err := ReadExtensionBytes(bts, &e) |
| 149 | if err != nil { |
| 150 | t.Errorf("error with extension (length %d): %s", len(bts), err) |
| 151 | } |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | func BenchmarkExtensionReadWrite(b *testing.B) { |
| 156 | var buf bytes.Buffer |
nothing calls this directly
no test coverage detected
searching dependent graphs…