MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / testTailSet

Method testTailSet

JSAT/test/jsat/utils/IntSortedSetTest.java:184–206  ·  view source on GitHub ↗
(SortedSet<Integer> groundTruth, SortedSet<Integer> testSet, Random rand, int depth)

Source from the content-addressed store, hash-verified

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 {

Callers 1

testSubSetMethod · 0.95

Calls 5

assertSameContentMethod · 0.95
lastMethod · 0.45
firstMethod · 0.45
tailSetMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected