(SortedSet<Integer> groundTruth, SortedSet<Integer> testSet, Random rand, int depth)
| 182 | } |
| 183 | |
| 184 | private void testTailSet(SortedSet<Integer> groundTruth, SortedSet<Integer> testSet, Random rand, int depth) |
| 185 | { |
| 186 | if(groundTruth.isEmpty() || groundTruth.last() - groundTruth.first() <= 0)//avoid bad tests |
| 187 | return; |
| 188 | int fromElement = groundTruth.first() + rand.nextInt(groundTruth.last() - groundTruth.first()); |
| 189 | |
| 190 | SortedSet<Integer> g_s = groundTruth.tailSet(fromElement); |
| 191 | SortedSet<Integer> t_s = testSet.tailSet(fromElement); |
| 192 | |
| 193 | assertSameContent(g_s, t_s); |
| 194 | for(int i = 0; i < 5; i++) |
| 195 | { |
| 196 | int new_val = fromElement+rand.nextInt(10000); |
| 197 | g_s.add(new_val); |
| 198 | t_s.add(new_val); |
| 199 | } |
| 200 | assertSameContent(g_s, t_s); |
| 201 | assertSameContent(groundTruth, testSet); |
| 202 | |
| 203 | if(depth-- > 0) |
| 204 | testTailSet(g_s, t_s, rand, depth); |
| 205 | assertSameContent(groundTruth, testSet); |
| 206 | } |
| 207 | |
| 208 | private void testSubSet(SortedSet<Integer> groundTruth, SortedSet<Integer> testSet, Random rand, int depth) |
| 209 | { |
no test coverage detected