(t *testing.T)
| 141 | } |
| 142 | |
| 143 | func 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 | |
| 168 | func TestMaxGapAddRandomWithRandomInterval(t *testing.T) { |
| 169 | var s gapSet |
nothing calls this directly
no test coverage detected
searching dependent graphs…