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.18 by jsr166, Fri Nov 5 00:17:22 2010 UTC vs.
Revision 1.22 by jsr166, Fri May 27 19:21:27 2011 UTC

# Line 1 | Line 1
1   /*
2   * Written by Doug Lea with assistance from members of JCP JSR-166
3   * Expert Group and released to the public domain, as explained at
4 < * http://creativecommons.org/licenses/publicdomain
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6  
7   import junit.framework.*;
# Line 269 | Line 269 | public class ConcurrentSkipListSetTest e
269          assertNull(q.pollFirst());
270      }
271  
272
272      /**
273       * remove(x) removes x and returns true if present
274       */
275      public void testRemoveElement() {
276          ConcurrentSkipListSet q = populatedSet(SIZE);
277          for (int i = 1; i < SIZE; i+=2) {
278 <            assertTrue(q.remove(new Integer(i)));
278 >            assertTrue(q.contains(i));
279 >            assertTrue(q.remove(i));
280 >            assertFalse(q.contains(i));
281 >            assertTrue(q.contains(i-1));
282          }
283          for (int i = 0; i < SIZE; i+=2) {
284 <            assertTrue(q.remove(new Integer(i)));
285 <            assertFalse(q.remove(new Integer(i+1)));
284 >            assertTrue(q.contains(i));
285 >            assertTrue(q.remove(i));
286 >            assertFalse(q.contains(i));
287 >            assertFalse(q.remove(i+1));
288 >            assertFalse(q.contains(i+1));
289          }
290          assertTrue(q.isEmpty());
291      }
# Line 360 | Line 365 | public class ConcurrentSkipListSetTest e
365          }
366      }
367  
363
364
368      /**
369       * lower returns preceding element
370       */
# Line 503 | Line 506 | public class ConcurrentSkipListSetTest e
506          assertFalse(it.hasNext());
507      }
508  
506
509      /**
510       * toString contains toStrings of elements
511       */
# Line 511 | Line 513 | public class ConcurrentSkipListSetTest e
513          ConcurrentSkipListSet q = populatedSet(SIZE);
514          String s = q.toString();
515          for (int i = 0; i < SIZE; ++i) {
516 <            assertTrue(s.indexOf(String.valueOf(i)) >= 0);
516 >            assertTrue(s.contains(String.valueOf(i)));
517          }
518      }
519  
# Line 840 | Line 842 | public class ConcurrentSkipListSetTest e
842       */
843      void check(NavigableSet<Integer> set,
844                        final int min, final int max, final boolean ascending) {
845 <       class ReferenceSet {
845 >        class ReferenceSet {
846              int lower(int element) {
847                  return ascending ?
848                      lowerAscending(element) : higherAscending(element);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines