MCPcopy Index your code
hub / github.com/google/gvisor / TestFirstOne

Function TestFirstOne

pkg/bitmap/bitmap_test.go:379–399  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

377}
378
379func TestFirstOne(t *testing.T) {
380 bitmap := New(uint32(1000))
381 bitmap.FlipRange(200, 400)
382 bitmap.FlipRange(700, 701)
383 testcases := []BitmapGetFirstTestcase{
384 {0, 200, false},
385 {199, 200, false},
386 {200, 200, false},
387 {399, 399, false},
388 {400, 700, false},
389 {700, 700, false},
390 {701, math.MaxInt32, true},
391 {10000, math.MaxInt32, true},
392 }
393 for _, tc := range testcases {
394 v, err := bitmap.FirstOne(tc.queryValue)
395 if v != tc.expectedValue && (err != nil) == tc.wantErr {
396 t.Errorf("FirstOne() returns: %v, wanted: %v", v, tc.expectedValue)
397 }
398 }
399}
400
401func TestGrow(t *testing.T) {
402 bitmap := New(uint32(64))

Callers

nothing calls this directly

Calls 4

FlipRangeMethod · 0.80
FirstOneMethod · 0.80
NewFunction · 0.70
ErrorfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…