ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/ConcurrentSkipListSetTest.java
(Generate patch)

Comparing jsr166/src/test/tck/ConcurrentSkipListSetTest.java (file contents):
Revision 1.16 by jsr166, Mon Oct 11 05:40:41 2010 UTC vs.
Revision 1.18 by jsr166, Fri Nov 5 00:17:22 2010 UTC

# Line 27 | Line 27 | public class ConcurrentSkipListSetTest e
27       * Create a set of given size containing consecutive
28       * Integers 0 ... n.
29       */
30 <    private ConcurrentSkipListSet populatedSet(int n) {
31 <        ConcurrentSkipListSet q = new ConcurrentSkipListSet();
30 >    private ConcurrentSkipListSet<Integer> populatedSet(int n) {
31 >        ConcurrentSkipListSet<Integer> q =
32 >            new ConcurrentSkipListSet<Integer>();
33          assertTrue(q.isEmpty());
34          for (int i = n-1; i >= 0; i-=2)
35              assertTrue(q.add(new Integer(i)));
# Line 434 | Line 435 | public class ConcurrentSkipListSetTest e
435      }
436  
437      /**
438 <     * toArray contains all elements
438 >     * toArray contains all elements in sorted order
439       */
440      public void testToArray() {
441          ConcurrentSkipListSet q = populatedSet(SIZE);
442          Object[] o = q.toArray();
442        Arrays.sort(o);
443          for (int i = 0; i < o.length; i++)
444 <            assertEquals(o[i], q.pollFirst());
444 >            assertSame(o[i], q.pollFirst());
445      }
446  
447      /**
448 <     * toArray(a) contains all elements
448 >     * toArray(a) contains all elements in sorted order
449       */
450      public void testToArray2() {
451 <        ConcurrentSkipListSet q = populatedSet(SIZE);
451 >        ConcurrentSkipListSet<Integer> q = populatedSet(SIZE);
452          Integer[] ints = new Integer[SIZE];
453 <        ints = (Integer[])q.toArray(ints);
454 <        Arrays.sort(ints);
453 >        Integer[] array = q.toArray(ints);
454 >        assertSame(ints, array);
455          for (int i = 0; i < ints.length; i++)
456 <            assertEquals(ints[i], q.pollFirst());
456 >            assertSame(ints[i], q.pollFirst());
457      }
458  
459      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines