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

Function BufferAtTester

buffer_test.go:173–204  ·  view source on GitHub ↗
(t *testing.T, b BufferAt)

Source from the content-addressed store, hash-verified

171}
172
173func BufferAtTester(t *testing.T, b BufferAt) {
174 t.Helper()
175 b.WriteAt([]byte("abc"), 0)
176 Compare(t, b, "abc")
177
178 b.WriteAt([]byte("abc"), 1)
179 Compare(t, b, "aabc")
180
181 b.WriteAt([]byte("abc"), 2)
182 Compare(t, b, "aaabc")
183
184 b.WriteAt([]byte("def"), 3)
185 switch {
186 case b.Cap() > 5:
187 Compare(t, b, "aaadef")
188 default:
189 Compare(t, b, "aaade")
190 }
191
192 b.Read(make([]byte, 2))
193 switch {
194 case b.Cap() > 5:
195 Compare(t, b, "adef")
196 default:
197 Compare(t, b, "ade")
198 }
199
200 b.WriteAt([]byte("ab"), 3)
201 Compare(t, b, "adeab")
202
203 b.Reset()
204}
205
206func Compare(t *testing.T, b BufferAt, s string) {
207 t.Helper()

Callers 1

TestWriteAtFunction · 0.85

Calls 5

CompareFunction · 0.85
CapMethod · 0.65
ResetMethod · 0.65
WriteAtMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…