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

Function TestMaxGapAddRandom

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

Source from the content-addressed store, hash-verified

141}
142
143func TestMaxGapAddRandom(t *testing.T) {
144 var s gapSet
145 order := rand.Perm(testSize)
146 var nrInsertions int
147 for i, j := range order {
148 s.InsertWithoutMergingRange(Range{j, j + 1}, j+valueOffset)
149 nrInsertions++
150 if err := s.segmentTestCheck(nrInsertions, validate); err != nil {
151 t.Errorf("Iteration %d: %v", i, err)
152 break
153 }
154 if err := checkSetMaxGap(&s); err != nil {
155 t.Errorf("When inserting %d: %v", j, err)
156 break
157 }
158 }
159 if got, want := s.countSegments(), nrInsertions; got != want {
160 t.Errorf("Wrong final number of segments: got %d, wanted %d", got, want)
161 }
162 if t.Failed() {
163 t.Logf("Insertion order: %v", order[:nrInsertions])
164 t.Logf("Set contents:\n%v", &s)
165 }
166}
167
168func TestMaxGapAddRandomWithRandomInterval(t *testing.T) {
169 var s gapSet

Callers

nothing calls this directly

Calls 6

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…