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

Comparing jsr166/src/test/tck/CountedCompleterTest.java (file contents):
Revision 1.24 by jsr166, Sun Oct 18 19:20:05 2015 UTC vs.
Revision 1.31 by jsr166, Wed Jan 4 06:09:58 2017 UTC

# Line 13 | Line 13 | import java.util.concurrent.CountedCompl
13   import java.util.concurrent.ExecutionException;
14   import java.util.concurrent.ForkJoinPool;
15   import java.util.concurrent.ForkJoinTask;
16 + import java.util.concurrent.ThreadLocalRandom;
17   import java.util.concurrent.TimeoutException;
18   import java.util.concurrent.atomic.AtomicInteger;
19   import java.util.concurrent.atomic.AtomicReference;
# Line 210 | Line 211 | public class CountedCompleterTest extend
211          final AtomicInteger onCompletionN = new AtomicInteger(0);
212          final AtomicInteger onExceptionalCompletionN = new AtomicInteger(0);
213          final AtomicInteger setRawResultN = new AtomicInteger(0);
214 <        final AtomicReference<Object> rawResult = new AtomicReference<Object>(null);
214 >        final AtomicReference<Object> rawResult = new AtomicReference<>(null);
215          int computeN() { return computeN.get(); }
216          int onCompletionN() { return onCompletionN.get(); }
217          int onExceptionalCompletionN() { return onExceptionalCompletionN.get(); }
# Line 335 | Line 336 | public class CountedCompleterTest extend
336      public void testSetPendingCount() {
337          NoopCC a = new NoopCC();
338          assertEquals(0, a.getPendingCount());
339 <        for (int val : new int[] { -1, 0, 1, Integer.MIN_VALUE, Integer.MAX_VALUE }) {
339 >        int[] vals = {
340 >             -1, 0, 1,
341 >             Integer.MIN_VALUE,
342 >             Integer.MAX_VALUE,
343 >        };
344 >        for (int val : vals) {
345              a.setPendingCount(val);
346              assertEquals(val, a.getPendingCount());
347          }
# Line 351 | Line 357 | public class CountedCompleterTest extend
357          assertEquals(1, a.getPendingCount());
358          a.addToPendingCount(27);
359          assertEquals(28, a.getPendingCount());
360 +        a.addToPendingCount(-28);
361 +        assertEquals(0, a.getPendingCount());
362      }
363  
364      /**
# Line 492 | Line 500 | public class CountedCompleterTest extend
500      }
501  
502      /**
503 <     * quietlyCompleteRoot completes root task
503 >     * quietlyCompleteRoot completes root task and only root task
504       */
505      public void testQuietlyCompleteRoot() {
506          NoopCC a = new NoopCC();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines