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

Function TestMaxGapAddRandomWithRandomInterval

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

Source from the content-addressed store, hash-verified

166}
167
168func TestMaxGapAddRandomWithRandomInterval(t *testing.T) {
169 var s gapSet
170 order := randIntervalPermutation(testSize)
171 var nrInsertions int
172 for i, j := range order {
173 s.InsertWithoutMergingRange(Range{j, j + rand.Intn(intervalLength-1) + 1}, j+valueOffset)
174 nrInsertions++
175 if err := s.segmentTestCheck(nrInsertions, validate); err != nil {
176 t.Errorf("Iteration %d: %v", i, err)
177 break
178 }
179 if err := checkSetMaxGap(&s); err != nil {
180 t.Errorf("When inserting %d: %v", j, err)
181 break
182 }
183 }
184 if got, want := s.countSegments(), nrInsertions; got != want {
185 t.Errorf("Wrong final number of segments: got %d, wanted %d", got, want)
186 }
187 if t.Failed() {
188 t.Logf("Insertion order: %v", order[:nrInsertions])
189 t.Logf("Set contents:\n%v", &s)
190 }
191}
192
193func TestMaxGapAddRandomWithMerge(t *testing.T) {
194 var s gapSet

Callers

nothing calls this directly

Calls 7

randIntervalPermutationFunction · 0.85
checkSetMaxGapFunction · 0.85
segmentTestCheckMethod · 0.80
countSegmentsMethod · 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…