[cvs] / jsr166 / src / test / tck / ArrayDequeTest.java Repository:
ViewVC logotype

Diff of /jsr166/src/test/tck/ArrayDequeTest.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.52, Sun Oct 30 21:07:27 2016 UTC revision 1.53, Thu Nov 3 15:45:56 2016 UTC
# Line 572  Line 572 
572       * removeFirstOccurrence(x) removes x and returns true if present       * removeFirstOccurrence(x) removes x and returns true if present
573       */       */
574      public void testRemoveFirstOccurrence() {      public void testRemoveFirstOccurrence() {
575          ArrayDeque q = populatedDeque(SIZE);          Deque<Integer> q = populatedDeque(SIZE);
576          assertFalse(q.removeFirstOccurrence(null));          assertFalse(q.removeFirstOccurrence(null));
577          for (int i = 1; i < SIZE; i += 2) {          for (int i = 1; i < SIZE; i += 2) {
578              assertTrue(q.removeFirstOccurrence(new Integer(i)));              assertTrue(q.removeFirstOccurrence(i));
579                assertFalse(q.contains(i));
580          }          }
581          for (int i = 0; i < SIZE; i += 2) {          for (int i = 0; i < SIZE; i += 2) {
582              assertTrue(q.removeFirstOccurrence(new Integer(i)));              assertTrue(q.removeFirstOccurrence(i));
583              assertFalse(q.removeFirstOccurrence(new Integer(i + 1)));              assertFalse(q.removeFirstOccurrence(i + 1));
584                assertFalse(q.contains(i));
585                assertFalse(q.contains(i + 1));
586          }          }
587          assertTrue(q.isEmpty());          assertTrue(q.isEmpty());
588          assertFalse(q.removeFirstOccurrence(null));          assertFalse(q.removeFirstOccurrence(null));
# Line 593  Line 596 
596       * removeLastOccurrence(x) removes x and returns true if present       * removeLastOccurrence(x) removes x and returns true if present
597       */       */
598      public void testRemoveLastOccurrence() {      public void testRemoveLastOccurrence() {
599          ArrayDeque q = populatedDeque(SIZE);          Deque<Integer> q = populatedDeque(SIZE);
600          assertFalse(q.removeLastOccurrence(null));          assertFalse(q.removeLastOccurrence(null));
601          for (int i = 1; i < SIZE; i += 2) {          for (int i = 1; i < SIZE; i += 2) {
602              assertTrue(q.removeLastOccurrence(new Integer(i)));              assertTrue(q.removeLastOccurrence(i));
603                assertFalse(q.contains(i));
604          }          }
605          for (int i = 0; i < SIZE; i += 2) {          for (int i = 0; i < SIZE; i += 2) {
606              assertTrue(q.removeLastOccurrence(new Integer(i)));              assertTrue(q.removeLastOccurrence(i));
607              assertFalse(q.removeLastOccurrence(new Integer(i + 1)));              assertFalse(q.removeLastOccurrence(i + 1));
608                assertFalse(q.contains(i));
609                assertFalse(q.contains(i + 1));
610          }          }
611          assertTrue(q.isEmpty());          assertTrue(q.isEmpty());
612          assertFalse(q.removeLastOccurrence(null));          assertFalse(q.removeLastOccurrence(null));
# Line 917  Line 923 
923          assertNotSame(y, x);          assertNotSame(y, x);
924          assertEquals(x.size(), y.size());          assertEquals(x.size(), y.size());
925          assertEquals(x.toString(), y.toString());          assertEquals(x.toString(), y.toString());
926            assertEquals(Arrays.toString(x.toArray()), Arrays.toString(y.toArray()));
927          assertTrue(Arrays.equals(x.toArray(), y.toArray()));          assertTrue(Arrays.equals(x.toArray(), y.toArray()));
928          while (!x.isEmpty()) {          while (!x.isEmpty()) {
929              assertFalse(y.isEmpty());              assertFalse(y.isEmpty());

Legend:
Removed from v.1.52  
changed lines
  Added in v.1.53

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8