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

Comparing jsr166/src/test/tck/ConcurrentSkipListSubSetTest.java (file contents):
Revision 1.33 by jsr166, Sat May 23 00:53:08 2015 UTC vs.
Revision 1.38 by jsr166, Sun Jan 7 22:59:18 2018 UTC

# Line 30 | Line 30 | public class ConcurrentSkipListSubSetTes
30  
31      /**
32       * Returns a new set of given size containing consecutive
33 <     * Integers 0 ... n.
33 >     * Integers 0 ... n - 1.
34       */
35 <    private NavigableSet<Integer> populatedSet(int n) {
36 <        ConcurrentSkipListSet<Integer> q =
37 <            new ConcurrentSkipListSet<Integer>();
35 >    private static NavigableSet<Integer> populatedSet(int n) {
36 >        ConcurrentSkipListSet<Integer> q = new ConcurrentSkipListSet<>();
37          assertTrue(q.isEmpty());
38  
39 <        for (int i = n-1; i >= 0; i -= 2)
39 >        for (int i = n - 1; i >= 0; i -= 2)
40              assertTrue(q.add(new Integer(i)));
41          for (int i = (n & 1); i < n; i += 2)
42              assertTrue(q.add(new Integer(i)));
# Line 52 | Line 51 | public class ConcurrentSkipListSubSetTes
51      /**
52       * Returns a new set of first 5 ints.
53       */
54 <    private NavigableSet set5() {
54 >    private static NavigableSet set5() {
55          ConcurrentSkipListSet q = new ConcurrentSkipListSet();
56          assertTrue(q.isEmpty());
57          q.add(one);
# Line 70 | Line 69 | public class ConcurrentSkipListSubSetTes
69      /**
70       * Returns a new set of first 5 negative ints.
71       */
72 <    private NavigableSet dset5() {
72 >    private static NavigableSet dset5() {
73          ConcurrentSkipListSet q = new ConcurrentSkipListSet();
74          assertTrue(q.isEmpty());
75          q.add(m1);
# Line 244 | Line 243 | public class ConcurrentSkipListSubSetTes
243              assertTrue(q.contains(i));
244              assertTrue(q.remove(i));
245              assertFalse(q.contains(i));
246 <            assertTrue(q.contains(i-1));
246 >            assertTrue(q.contains(i - 1));
247          }
248          for (int i = 0; i < SIZE; i += 2) {
249              assertTrue(q.contains(i));
250              assertTrue(q.remove(i));
251              assertFalse(q.contains(i));
252 <            assertFalse(q.remove(i+1));
253 <            assertFalse(q.contains(i+1));
252 >            assertFalse(q.remove(i + 1));
253 >            assertFalse(q.contains(i + 1));
254          }
255          assertTrue(q.isEmpty());
256      }
# Line 476 | Line 475 | public class ConcurrentSkipListSubSetTes
475      }
476  
477      /**
478 <     * A deserialized serialized set has same elements
478 >     * A deserialized/reserialized set equals original
479       */
480      public void testSerialization() throws Exception {
481          NavigableSet x = populatedSet(SIZE);
# Line 741 | Line 740 | public class ConcurrentSkipListSubSetTes
740          }
741          for (int i = 0; i < SIZE; i += 2 ) {
742              assertTrue(q.remove(new Integer(i)));
743 <            assertFalse(q.remove(new Integer(i+1)));
743 >            assertFalse(q.remove(new Integer(i + 1)));
744          }
745          assertTrue(q.isEmpty());
746      }
# Line 975 | Line 974 | public class ConcurrentSkipListSubSetTes
974      }
975  
976      /**
977 <     * A deserialized serialized set has same elements
977 >     * A deserialized/reserialized set equals original
978       */
979      public void testDescendingSerialization() throws Exception {
980          NavigableSet x = dset5();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines