[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.48, Mon Oct 17 15:48:01 2016 UTC revision 1.49, Fri Oct 21 03:24:00 2016 UTC
# Line 1019  Line 1019 
1019    
1020      /**      /**
1021       * Handle capacities near Integer.MAX_VALUE.       * Handle capacities near Integer.MAX_VALUE.
1022       * ant -Dvmoptions=-Xmx24g -Djsr166.expensiveTests=true -Djsr166.tckTestClass=ArrayDequeTest -Djsr166.methodFilter=testHuge tck       * ant -Dvmoptions='-Xms22g -Xmx22g' -Djsr166.testImplementationDetails=true -Djsr166.expensiveTests=true -Djsr166.tckTestClass=ArrayDequeTest -Djsr166.methodFilter=testHuge tck
1023       */       */
1024      public void testHuge() {      public void testHuge() {
1025          if (! (testImplementationDetails          if (! (testImplementationDetails
1026                 && expensiveTests                 && expensiveTests
1027                 && Runtime.getRuntime().freeMemory() > 21_000_000_000L))                 && Runtime.getRuntime().maxMemory() > 21_000_000_000L))
1028              return;              return;
         int maxSize = Integer.MAX_VALUE - 8;  
         ArrayDeque<Integer> q;  
1029    
1030          q = new ArrayDeque<>(maxSize);          ArrayDeque q;
1031            final int maxSize = Integer.MAX_VALUE - 8;
1032    
1033          assertThrows(OutOfMemoryError.class,          assertThrows(OutOfMemoryError.class,
1034                       () -> new ArrayDeque<>(Integer.MAX_VALUE));                       () -> new ArrayDeque<>(Integer.MAX_VALUE));
1035    
1036          q = populatedDeque(0);          {
1037                q = new ArrayDeque<>(maxSize);
1038                q = null;
1039            }
1040    
1041            {
1042                q = new ArrayDeque();
1043          assertTrue(q.addAll(Collections.nCopies(maxSize - 2, (Integer) 42)));          assertTrue(q.addAll(Collections.nCopies(maxSize - 2, (Integer) 42)));
1044          assertEquals((Integer) 42, q.peekFirst());          assertEquals((Integer) 42, q.peekFirst());
1045          assertEquals((Integer) 42, q.peekLast());          assertEquals((Integer) 42, q.peekLast());
# Line 1044  Line 1049 
1049          assertEquals((Integer) 0, q.peekFirst());          assertEquals((Integer) 0, q.peekFirst());
1050          assertEquals((Integer) 1, q.peekLast());          assertEquals((Integer) 1, q.peekLast());
1051          assertEquals(maxSize, q.size());          assertEquals(maxSize, q.size());
1052                q = null;
1053            }
1054      }      }
1055    
1056  }  }

Legend:
Removed from v.1.48  
changed lines
  Added in v.1.49

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8