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.6 by jsr166, Mon Nov 16 05:30:07 2009 UTC vs.
Revision 1.7 by jsr166, Sat Nov 21 02:07:26 2009 UTC

# Line 11 | Line 11 | import java.io.*;
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);
17 >        return new TestSuite(ConcurrentSkipListSetTest.class);
18      }
19  
20      static class MyReverseComparator implements Comparator {
# Line 34 | Line 34 | public class ConcurrentSkipListSetTest e
34      private ConcurrentSkipListSet populatedSet(int n) {
35          ConcurrentSkipListSet q = new ConcurrentSkipListSet();
36          assertTrue(q.isEmpty());
37 <        for (int i = n-1; i >= 0; i-=2)
38 <            assertTrue(q.add(new Integer(i)));
39 <        for (int i = (n & 1); i < n; i+=2)
40 <            assertTrue(q.add(new Integer(i)));
37 >        for (int i = n-1; i >= 0; i-=2)
38 >            assertTrue(q.add(new Integer(i)));
39 >        for (int i = (n & 1); i < n; i+=2)
40 >            assertTrue(q.add(new Integer(i)));
41          assertFalse(q.isEmpty());
42 <        assertEquals(n, q.size());
42 >        assertEquals(n, q.size());
43          return q;
44      }
45  
# Line 54 | Line 54 | public class ConcurrentSkipListSetTest e
54          q.add(three);
55          q.add(four);
56          q.add(five);
57 <        assertEquals(5, q.size());
57 >        assertEquals(5, q.size());
58          return q;
59      }
60  
# Line 168 | Line 168 | public class ConcurrentSkipListSetTest e
168       * add(null) throws NPE
169       */
170      public void testAddNull() {
171 <        try {
171 >        try {
172              ConcurrentSkipListSet q = new ConcurrentSkipListSet();
173              q.add(null);
174              shouldThrow();
# Line 272 | Line 272 | public class ConcurrentSkipListSetTest e
272          for (int i = 0; i < SIZE; ++i) {
273              assertEquals(i, ((Integer)q.pollFirst()).intValue());
274          }
275 <        assertNull(q.pollFirst());
275 >        assertNull(q.pollFirst());
276      }
277  
278      /**
# Line 283 | Line 283 | public class ConcurrentSkipListSetTest e
283          for (int i = SIZE-1; i >= 0; --i) {
284              assertEquals(i, ((Integer)q.pollLast()).intValue());
285          }
286 <        assertNull(q.pollFirst());
286 >        assertNull(q.pollFirst());
287      }
288  
289  
# Line 460 | Line 460 | public class ConcurrentSkipListSetTest e
460       */
461      public void testToArray() {
462          ConcurrentSkipListSet q = populatedSet(SIZE);
463 <        Object[] o = q.toArray();
463 >        Object[] o = q.toArray();
464          Arrays.sort(o);
465 <        for (int i = 0; i < o.length; i++)
466 <            assertEquals(o[i], q.pollFirst());
465 >        for (int i = 0; i < o.length; i++)
466 >            assertEquals(o[i], q.pollFirst());
467      }
468  
469      /**
# Line 471 | Line 471 | public class ConcurrentSkipListSetTest e
471       */
472      public void testToArray2() {
473          ConcurrentSkipListSet q = populatedSet(SIZE);
474 <        Integer[] ints = new Integer[SIZE];
475 <        ints = (Integer[])q.toArray(ints);
474 >        Integer[] ints = new Integer[SIZE];
475 >        ints = (Integer[])q.toArray(ints);
476          Arrays.sort(ints);
477          for (int i = 0; i < ints.length; i++)
478              assertEquals(ints[i], q.pollFirst());
# Line 484 | Line 484 | public class ConcurrentSkipListSetTest e
484      public void testIterator() {
485          ConcurrentSkipListSet q = populatedSet(SIZE);
486          int i = 0;
487 <        Iterator it = q.iterator();
487 >        Iterator it = q.iterator();
488          while (it.hasNext()) {
489              assertTrue(q.contains(it.next()));
490              ++i;
# Line 498 | Line 498 | public class ConcurrentSkipListSetTest e
498      public void testEmptyIterator() {
499          ConcurrentSkipListSet q = new ConcurrentSkipListSet();
500          int i = 0;
501 <        Iterator it = q.iterator();
501 >        Iterator it = q.iterator();
502          while (it.hasNext()) {
503              assertTrue(q.contains(it.next()));
504              ++i;
# Line 686 | Line 686 | public class ConcurrentSkipListSetTest e
686       * Subsets of subsets subdivide correctly
687       */
688      public void testRecursiveSubSets() {
689 <        int setSize = 1000;
690 <        Class cl = ConcurrentSkipListSet.class;
689 >        int setSize = 1000;
690 >        Class cl = ConcurrentSkipListSet.class;
691  
692          NavigableSet<Integer> set = newSet(cl);
693          bs = new BitSet(setSize);
# Line 706 | Line 706 | public class ConcurrentSkipListSetTest e
706  
707      static NavigableSet<Integer> newSet(Class cl) {
708          NavigableSet<Integer> result = null;
709 <        try {
709 >        try {
710              result = (NavigableSet<Integer>) cl.newInstance();
711 <        } catch (Exception e) {
711 >        } catch (Exception e) {
712              fail();
713 <        }
713 >        }
714          assertEquals(result.size(), 0);
715          assertFalse(result.iterator().hasNext());
716          return result;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines