MCPcopy
hub / github.com/skip2/go-qrcode / TestSubstr

Function TestSubstr

bitset/bitset_test.go:278–321  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

276}
277
278func TestSubstr(t *testing.T) {
279 data := []bool{b0, b1, b0, b1, b0, b1, b1, b0}
280
281 tests := []struct {
282 start int
283 end int
284 expected []bool
285 }{
286 {
287 0,
288 8,
289 []bool{b0, b1, b0, b1, b0, b1, b1, b0},
290 },
291 {
292 0,
293 0,
294 []bool{},
295 },
296 {
297 0,
298 1,
299 []bool{b0},
300 },
301 {
302 2,
303 4,
304 []bool{b0, b1},
305 },
306 }
307
308 for _, test := range tests {
309 b := New()
310 b.AppendBools(data...)
311
312 result := b.Substr(test.start, test.end)
313
314 expected := New()
315 expected.AppendBools(test.expected...)
316
317 if !result.Equals(expected) {
318 t.Errorf("Got %s, expected %s", result.String(), expected.String())
319 }
320 }
321}

Callers

nothing calls this directly

Calls 5

AppendBoolsMethod · 0.80
SubstrMethod · 0.80
EqualsMethod · 0.80
StringMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…