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.2 by dl, Wed Apr 19 15:10:54 2006 UTC vs.
Revision 1.4 by jsr166, Mon Nov 2 20:28:31 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);
18      }
19  
20 <    static class MyReverseComparator implements Comparator {
20 >    static class MyReverseComparator implements Comparator {
21          public int compare(Object x, Object y) {
22              int i = ((Integer)x).intValue();
23              int j = ((Integer)y).intValue();
# Line 57 | Line 57 | public class ConcurrentSkipListSetTest e
57          assertEquals(5, q.size());
58          return q;
59      }
60 <
60 >
61      /**
62       * A new set has unbounded capacity
63       */
# Line 172 | Line 172 | public class ConcurrentSkipListSetTest e
172              ConcurrentSkipListSet q = new ConcurrentSkipListSet();
173              q.add(null);
174              shouldThrow();
175 <        } catch (NullPointerException success) { }  
175 >        } catch (NullPointerException success) { }
176      }
177  
178      /**
# Line 301 | Line 301 | public class ConcurrentSkipListSetTest e
301          }
302          assertTrue(q.isEmpty());
303      }
304 <        
304 >
305      /**
306       * contains(x) reports true when elements added but not yet removed
307       */
# Line 377 | Line 377 | public class ConcurrentSkipListSetTest e
377          }
378      }
379  
380 <    
380 >
381  
382      /**
383       * lower returns preceding element
# Line 477 | Line 477 | public class ConcurrentSkipListSetTest e
477          for(int i = 0; i < ints.length; i++)
478              assertEquals(ints[i], q.pollFirst());
479      }
480 <    
480 >
481      /**
482       * iterator iterates through all elements
483       */
# Line 535 | Line 535 | public class ConcurrentSkipListSetTest e
535          for (int i = 0; i < SIZE; ++i) {
536              assertTrue(s.indexOf(String.valueOf(i)) >= 0);
537          }
538 <    }        
538 >    }
539  
540      /**
541 <     * A deserialized serialized set has same elements
541 >     * A deserialized serialized set has same elements
542       */
543      public void testSerialization() {
544          ConcurrentSkipListSet q = populatedSet(SIZE);
# Line 552 | Line 552 | public class ConcurrentSkipListSetTest e
552              ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
553              ConcurrentSkipListSet r = (ConcurrentSkipListSet)in.readObject();
554              assertEquals(q.size(), r.size());
555 <            while (!q.isEmpty())
555 >            while (!q.isEmpty())
556                  assertEquals(q.pollFirst(), r.pollFirst());
557          } catch(Exception e){
558              e.printStackTrace();
# Line 700 | Line 700 | public class ConcurrentSkipListSetTest e
700          check(set,                 0, setSize - 1, true);
701          check(set.descendingSet(), 0, setSize - 1, false);
702  
703 <        bashSubSet(set.navigableSubSet(0, true, setSize, false),
703 >        bashSubSet(set.subSet(0, true, setSize, false),
704                     0, setSize - 1, true);
705      }
706  
# Line 807 | Line 807 | public class ConcurrentSkipListSetTest e
807  
808          // headSet - pick direction and endpoint inclusion randomly
809          boolean incl = rnd.nextBoolean();
810 <        NavigableSet<Integer> hm = set.navigableHeadSet(midPoint, incl);
810 >        NavigableSet<Integer> hm = set.headSet(midPoint, incl);
811          if (ascending) {
812              if (rnd.nextBoolean())
813                  bashSubSet(hm, min, midPoint - (incl ? 0 : 1), true);
# Line 824 | Line 824 | public class ConcurrentSkipListSetTest e
824  
825          // tailSet - pick direction and endpoint inclusion randomly
826          incl = rnd.nextBoolean();
827 <        NavigableSet<Integer> tm = set.navigableTailSet(midPoint,incl);
827 >        NavigableSet<Integer> tm = set.tailSet(midPoint,incl);
828          if (ascending) {
829              if (rnd.nextBoolean())
830                  bashSubSet(tm, midPoint + (incl ? 0 : 1), max, true);
# Line 849 | Line 849 | public class ConcurrentSkipListSetTest e
849          boolean lowIncl = rnd.nextBoolean();
850          boolean highIncl = rnd.nextBoolean();
851          if (ascending) {
852 <            NavigableSet<Integer> sm = set.navigableSubSet(
852 >            NavigableSet<Integer> sm = set.subSet(
853                  endpoints[0], lowIncl, endpoints[1], highIncl);
854              if (rnd.nextBoolean())
855                  bashSubSet(sm, endpoints[0] + (lowIncl ? 0 : 1),
# Line 858 | Line 858 | public class ConcurrentSkipListSetTest e
858                  bashSubSet(sm.descendingSet(), endpoints[0] + (lowIncl ? 0 : 1),
859                             endpoints[1] - (highIncl ? 0 : 1), false);
860          } else {
861 <            NavigableSet<Integer> sm = set.navigableSubSet(
861 >            NavigableSet<Integer> sm = set.subSet(
862                  endpoints[1], highIncl, endpoints[0], lowIncl);
863              if (rnd.nextBoolean())
864                  bashSubSet(sm, endpoints[0] + (lowIncl ? 0 : 1),

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines