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

Comparing jsr166/src/test/tck/LinkedListTest.java (file contents):
Revision 1.39 by jsr166, Sat May 23 00:53:08 2015 UTC vs.
Revision 1.43 by jsr166, Mon Nov 14 23:57:55 2016 UTC

# Line 21 | Line 21 | public class LinkedListTest extends JSR1
21      }
22  
23      public static Test suite() {
24 <        return new TestSuite(LinkedListTest.class);
24 >        class Implementation implements CollectionImplementation {
25 >            public Class<?> klazz() { return LinkedList.class; }
26 >            public Collection emptyCollection() { return new LinkedList(); }
27 >            public Object makeElement(int i) { return i; }
28 >            public boolean isConcurrent() { return false; }
29 >            public boolean permitsNulls() { return true; }
30 >        }
31 >        class SubListImplementation extends Implementation {
32 >            public Collection emptyCollection() {
33 >                return new LinkedList().subList(0, 0);
34 >            }
35 >        }
36 >        return newTestSuite(
37 >                LinkedListTest.class,
38 >                CollectionTest.testSuite(new Implementation()),
39 >                CollectionTest.testSuite(new SubListImplementation()));
40      }
41  
42      /**
43       * Returns a new queue of given size containing consecutive
44 <     * Integers 0 ... n.
44 >     * Integers 0 ... n - 1.
45       */
46      private LinkedList<Integer> populatedQueue(int n) {
47          LinkedList<Integer> q = new LinkedList<Integer>();
# Line 35 | Line 50 | public class LinkedListTest extends JSR1
50              assertTrue(q.offer(new Integer(i)));
51          assertFalse(q.isEmpty());
52          assertEquals(n, q.size());
53 +        assertEquals((Integer) 0, q.peekFirst());
54 +        assertEquals((Integer) (n - 1), q.peekLast());
55          return q;
56      }
57  
# Line 243 | Line 260 | public class LinkedListTest extends JSR1
260              assertTrue(q.contains(i));
261              assertTrue(q.remove((Integer)i));
262              assertFalse(q.contains(i));
263 <            assertTrue(q.contains(i-1));
263 >            assertTrue(q.contains(i - 1));
264          }
265          for (int i = 0; i < SIZE; i += 2) {
266              assertTrue(q.contains(i));
267              assertTrue(q.remove((Integer)i));
268              assertFalse(q.contains(i));
269 <            assertFalse(q.remove((Integer)(i+1)));
270 <            assertFalse(q.contains(i+1));
269 >            assertFalse(q.remove((Integer)(i + 1)));
270 >            assertFalse(q.contains(i + 1));
271          }
272          assertTrue(q.isEmpty());
273      }
# Line 619 | Line 636 | public class LinkedListTest extends JSR1
636          }
637          for (int i = 0; i < SIZE; i += 2) {
638              assertTrue(q.removeFirstOccurrence(new Integer(i)));
639 <            assertFalse(q.removeFirstOccurrence(new Integer(i+1)));
639 >            assertFalse(q.removeFirstOccurrence(new Integer(i + 1)));
640          }
641          assertTrue(q.isEmpty());
642      }
# Line 634 | Line 651 | public class LinkedListTest extends JSR1
651          }
652          for (int i = 0; i < SIZE; i += 2) {
653              assertTrue(q.removeLastOccurrence(new Integer(i)));
654 <            assertFalse(q.removeLastOccurrence(new Integer(i+1)));
654 >            assertFalse(q.removeLastOccurrence(new Integer(i + 1)));
655          }
656          assertTrue(q.isEmpty());
657      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines