MCPcopy Create free account
hub / github.com/djherbis/buffer / Compare

Function Compare

buffer_test.go:206–218  ·  view source on GitHub ↗
(t *testing.T, b BufferAt, s string)

Source from the content-addressed store, hash-verified

204}
205
206func Compare(t *testing.T, b BufferAt, s string) {
207 t.Helper()
208 data := make([]byte, b.Len())
209 n, _ := b.ReadAt(data, 0)
210 if string(data[:n]) != s {
211 t.Errorf("Mismatch: got %q want %q", string(data[:n]), s)
212 }
213 off := int64(len(s) / 2)
214 n, _ = b.ReadAt(data, off)
215 if string(data[:n]) != s[off:] {
216 t.Errorf("Mismatch: got %q want %q", string(data[:n]), s[off:])
217 }
218}
219
220func TestRingComplex(t *testing.T) {
221 ringSize := 10

Callers 1

BufferAtTesterFunction · 0.85

Calls 2

LenMethod · 0.65
ReadAtMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…