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.4 by jsr166, Mon Nov 2 20:28:31 2009 UTC vs.
Revision 1.5 by jsr166, Mon Nov 16 04:57:10 2009 UTC

# 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)
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)
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());
# Line 204 | Line 204 | public class ConcurrentSkipListSetTest e
204              q.add(new Object());
205              shouldThrow();
206          }
207 <        catch(ClassCastException success) {}
207 >        catch (ClassCastException success) {}
208      }
209  
210      /**
# Line 462 | Line 462 | public class ConcurrentSkipListSetTest e
462          ConcurrentSkipListSet q = populatedSet(SIZE);
463          Object[] o = q.toArray();
464          Arrays.sort(o);
465 <        for(int i = 0; i < o.length; i++)
465 >        for (int i = 0; i < o.length; i++)
466              assertEquals(o[i], q.pollFirst());
467      }
468  
# Line 474 | Line 474 | public class ConcurrentSkipListSetTest e
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++)
477 >        for (int i = 0; i < ints.length; i++)
478              assertEquals(ints[i], q.pollFirst());
479      }
480  
# Line 485 | Line 485 | public class ConcurrentSkipListSetTest e
485          ConcurrentSkipListSet q = populatedSet(SIZE);
486          int i = 0;
487          Iterator it = q.iterator();
488 <        while(it.hasNext()) {
488 >        while (it.hasNext()) {
489              assertTrue(q.contains(it.next()));
490              ++i;
491          }
# Line 499 | Line 499 | public class ConcurrentSkipListSetTest e
499          ConcurrentSkipListSet q = new ConcurrentSkipListSet();
500          int i = 0;
501          Iterator it = q.iterator();
502 <        while(it.hasNext()) {
502 >        while (it.hasNext()) {
503              assertTrue(q.contains(it.next()));
504              ++i;
505          }
# Line 554 | Line 554 | public class ConcurrentSkipListSetTest e
554              assertEquals(q.size(), r.size());
555              while (!q.isEmpty())
556                  assertEquals(q.pollFirst(), r.pollFirst());
557 <        } catch(Exception e){
557 >        } catch (Exception e){
558              e.printStackTrace();
559              unexpectedException();
560          }
# Line 708 | Line 708 | public class ConcurrentSkipListSetTest e
708          NavigableSet<Integer> result = null;
709          try {
710              result = (NavigableSet<Integer>) cl.newInstance();
711 <        } catch(Exception e) {
711 >        } catch (Exception e) {
712              fail();
713          }
714          assertEquals(result.size(), 0);
# Line 733 | Line 733 | public class ConcurrentSkipListSetTest e
733          }
734  
735          // Remove a bunch of entries with iterator
736 <        for(Iterator<Integer> it = set.iterator(); it.hasNext(); ) {
736 >        for (Iterator<Integer> it = set.iterator(); it.hasNext(); ) {
737              if (rnd.nextBoolean()) {
738                  bs.clear(it.next());
739                  it.remove();
# Line 758 | Line 758 | public class ConcurrentSkipListSetTest e
758          }
759  
760          // Remove a bunch of entries with iterator
761 <        for(Iterator<Integer> it = set.iterator(); it.hasNext(); ) {
761 >        for (Iterator<Integer> it = set.iterator(); it.hasNext(); ) {
762              if (rnd.nextBoolean()) {
763                  bs.clear(it.next());
764                  it.remove();
# Line 774 | Line 774 | public class ConcurrentSkipListSetTest e
774                  try {
775                      set.add(element);
776                      fail();
777 <                } catch(IllegalArgumentException e) {
777 >                } catch (IllegalArgumentException e) {
778                      // expected
779                  }
780              }
# Line 976 | Line 976 | public class ConcurrentSkipListSetTest e
976              try {
977                  set.first();
978                  fail();
979 <            } catch(NoSuchElementException e) {
979 >            } catch (NoSuchElementException e) {
980                  // expected
981              }
982              try {
983                  set.last();
984                  fail();
985 <            } catch(NoSuchElementException e) {
985 >            } catch (NoSuchElementException e) {
986                  // expected
987              }
988          }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines