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

Function TestAddRandom

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

Source from the content-addressed store, hash-verified

90}
91
92func TestAddRandom(t *testing.T) {
93 var s Set
94 order := rand.Perm(testSize)
95 var nrInsertions int
96 for i, j := range order {
97 s.InsertWithoutMergingRange(Range{j, j + 1}, j+valueOffset)
98 nrInsertions++
99 if err := s.segmentTestCheck(nrInsertions, validate); err != nil {
100 t.Errorf("Iteration %d: %v", i, err)
101 break
102 }
103 }
104 if got, want := s.countSegments(), nrInsertions; got != want {
105 t.Errorf("Wrong final number of segments: got %d, wanted %d", got, want)
106 }
107 if t.Failed() {
108 t.Logf("Insertion order: %v", order[:nrInsertions])
109 t.Logf("Set contents:\n%v", &s)
110 }
111}
112
113func TestRemoveRandom(t *testing.T) {
114 var s Set

Callers

nothing calls this directly

Calls 5

segmentTestCheckMethod · 0.95
countSegmentsMethod · 0.95
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…