11 |
|
|
12 |
|
public class ConcurrentSkipListSetTest extends JSR166TestCase { |
13 |
|
public static void main(String[] args) { |
14 |
< |
junit.textui.TestRunner.run (suite()); |
14 |
> |
junit.textui.TestRunner.run(suite()); |
15 |
|
} |
16 |
|
public static Test suite() { |
17 |
|
return new TestSuite(ConcurrentSkipListSetTest.class); |
203 |
|
shouldThrow(); |
204 |
|
} catch (NullPointerException success) {} |
205 |
|
} |
206 |
+ |
|
207 |
|
/** |
208 |
|
* addAll of a collection with null elements throws NPE |
209 |
|
*/ |
215 |
|
shouldThrow(); |
216 |
|
} catch (NullPointerException success) {} |
217 |
|
} |
218 |
+ |
|
219 |
|
/** |
220 |
|
* addAll of a collection with any null elements throws NPE after |
221 |
|
* possibly adding some elements |
377 |
|
|
378 |
|
Object e4 = q.lower(zero); |
379 |
|
assertNull(e4); |
378 |
– |
|
380 |
|
} |
381 |
|
|
382 |
|
/** |
395 |
|
|
396 |
|
Object e4 = q.higher(six); |
397 |
|
assertNull(e4); |
397 |
– |
|
398 |
|
} |
399 |
|
|
400 |
|
/** |
413 |
|
|
414 |
|
Object e4 = q.floor(zero); |
415 |
|
assertNull(e4); |
416 |
– |
|
416 |
|
} |
417 |
|
|
418 |
|
/** |
431 |
|
|
432 |
|
Object e4 = q.ceiling(six); |
433 |
|
assertNull(e4); |
435 |
– |
|
434 |
|
} |
435 |
|
|
436 |
|
/** |
437 |
< |
* toArray contains all elements |
437 |
> |
* toArray contains all elements in sorted order |
438 |
|
*/ |
439 |
|
public void testToArray() { |
440 |
|
ConcurrentSkipListSet q = populatedSet(SIZE); |
441 |
|
Object[] o = q.toArray(); |
444 |
– |
Arrays.sort(o); |
442 |
|
for (int i = 0; i < o.length; i++) |
443 |
< |
assertEquals(o[i], q.pollFirst()); |
443 |
> |
assertSame(o[i], q.pollFirst()); |
444 |
|
} |
445 |
|
|
446 |
|
/** |
447 |
< |
* toArray(a) contains all elements |
447 |
> |
* toArray(a) contains all elements in sorted order |
448 |
|
*/ |
449 |
|
public void testToArray2() { |
450 |
|
ConcurrentSkipListSet q = populatedSet(SIZE); |
451 |
|
Integer[] ints = new Integer[SIZE]; |
452 |
< |
ints = (Integer[])q.toArray(ints); |
456 |
< |
Arrays.sort(ints); |
452 |
> |
assertSame(ints, q.toArray(ints)); |
453 |
|
for (int i = 0; i < ints.length; i++) |
454 |
< |
assertEquals(ints[i], q.pollFirst()); |
454 |
> |
assertSame(ints[i], q.pollFirst()); |
455 |
|
} |
456 |
|
|
457 |
|
/** |
485 |
|
/** |
486 |
|
* iterator.remove removes current element |
487 |
|
*/ |
488 |
< |
public void testIteratorRemove () { |
488 |
> |
public void testIteratorRemove() { |
489 |
|
final ConcurrentSkipListSet q = new ConcurrentSkipListSet(); |
490 |
|
q.add(new Integer(2)); |
491 |
|
q.add(new Integer(1)); |
657 |
|
* Subsets of subsets subdivide correctly |
658 |
|
*/ |
659 |
|
public void testRecursiveSubSets() throws Exception { |
660 |
< |
int setSize = 1000; |
660 |
> |
int setSize = expensiveTests ? 1000 : 100; |
661 |
|
Class cl = ConcurrentSkipListSet.class; |
662 |
|
|
663 |
|
NavigableSet<Integer> set = newSet(cl); |
873 |
|
// BitSet should support this! Test would run much faster |
874 |
|
while (element >= min) { |
875 |
|
if (bs.get(element)) |
876 |
< |
return(element); |
876 |
> |
return element; |
877 |
|
element--; |
878 |
|
} |
879 |
|
return -1; |