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

Comparing jsr166/src/test/tck/SplittableRandomTest.java (file contents):
Revision 1.13 by jsr166, Fri Sep 27 20:29:31 2013 UTC vs.
Revision 1.18 by jsr166, Sat Apr 25 04:55:31 2015 UTC

# Line 3 | Line 3
3   * Expert Group and released to the public domain, as explained at
4   * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6 < import junit.framework.*;
7 < import java.util.*;
6 >
7   import java.util.SplittableRandom;
8   import java.util.concurrent.atomic.AtomicInteger;
10 import java.util.concurrent.atomic.AtomicLong;
9   import java.util.concurrent.atomic.LongAdder;
10  
11 + import junit.framework.Test;
12 + import junit.framework.TestSuite;
13 +
14   public class SplittableRandomTest extends JSR166TestCase {
15  
16      public static void main(String[] args) {
17 <        junit.textui.TestRunner.run(suite());
17 >        main(suite(), args);
18      }
19      public static Test suite() {
20          return new TestSuite(SplittableRandomTest.class);
# Line 89 | Line 90 | public class SplittableRandomTest extend
90       * same values for nextLong.
91       */
92      public void testSeedConstructor() {
93 <        for (long seed = 2; seed < MAX_LONG_BOUND; seed += 15485863)  {
93 >        for (long seed = 2; seed < MAX_LONG_BOUND; seed += 15485863) {
94              SplittableRandom sr1 = new SplittableRandom(seed);
95              SplittableRandom sr2 = new SplittableRandom(seed);
96              for (int i = 0; i < REPS; ++i)
# Line 409 | Line 410 | public class SplittableRandomTest extend
410          for (int least = -15485867; least < MAX_INT_BOUND; least += 524959) {
411              for (int bound = least + 2; bound > least && bound < MAX_INT_BOUND; bound += 67867967) {
412                  final int lo = least, hi = bound;
413 <                r.ints(size, lo, hi).parallel().
414 <                    forEach(x -> {if (x < lo || x >= hi)
415 <                                fails.getAndIncrement(); });
413 >                r.ints(size, lo, hi).parallel().forEach(
414 >                    x -> {
415 >                        if (x < lo || x >= hi)
416 >                            fails.getAndIncrement(); });
417              }
418          }
419          assertEquals(0, fails.get());
# Line 427 | Line 429 | public class SplittableRandomTest extend
429          for (long least = -86028121; least < MAX_LONG_BOUND; least += 1982451653L) {
430              for (long bound = least + 2; bound > least && bound < MAX_LONG_BOUND; bound += Math.abs(bound * 7919)) {
431                  final long lo = least, hi = bound;
432 <                r.longs(size, lo, hi).parallel().
433 <                    forEach(x -> {if (x < lo || x >= hi)
434 <                                fails.getAndIncrement(); });
432 >                r.longs(size, lo, hi).parallel().forEach(
433 >                    x -> {
434 >                        if (x < lo || x >= hi)
435 >                            fails.getAndIncrement(); });
436              }
437          }
438          assertEquals(0, fails.get());
# Line 445 | Line 448 | public class SplittableRandomTest extend
448          for (double least = 0.00011; least < 1.0e20; least *= 9) {
449              for (double bound = least * 1.0011; bound < 1.0e20; bound *= 17) {
450                  final double lo = least, hi = bound;
451 <                r.doubles(size, lo, hi).parallel().
452 <                    forEach(x -> {if (x < lo || x >= hi)
453 <                                fails.getAndIncrement(); });
451 >                r.doubles(size, lo, hi).parallel().forEach(
452 >                    x -> {
453 >                        if (x < lo || x >= hi)
454 >                            fails.getAndIncrement(); });
455              }
456          }
457          assertEquals(0, fails.get());

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines