MCPcopy
hub / github.com/google/gvisor / TestMaxGapRemoveHalfRandomWithMerge

Function TestMaxGapRemoveHalfRandomWithMerge

pkg/segment/test/segment_test.go:283–303  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

281}
282
283func TestMaxGapRemoveHalfRandomWithMerge(t *testing.T) {
284 var s gapSet
285 s.InsertRange(Range{0, intervalLength * testSize}, 0)
286 order := randIntervalPermutation(testSize)
287 order = order[:testSize/2]
288 var nrRemovals int
289 for _, j := range order {
290 temprange := Range{j, j + intervalLength}
291 s.RemoveFullRange(temprange)
292 nrRemovals++
293 if err := checkSetMaxGap(&s); err != nil {
294 t.Errorf("When removing %v: %v", temprange, err)
295 break
296 }
297 }
298 if t.Failed() {
299 t.Logf("Removal order: %v", order[:nrRemovals])
300 t.Logf("Set contents:\n%v", &s)
301 t.FailNow()
302 }
303}
304
305func TestNextLargeEnoughGap(t *testing.T) {
306 var s gapSet

Callers

nothing calls this directly

Calls 6

randIntervalPermutationFunction · 0.85
checkSetMaxGapFunction · 0.85
InsertRangeMethod · 0.80
RemoveFullRangeMethod · 0.80
ErrorfMethod · 0.65
LogfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…