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.16 by jsr166, Wed Dec 31 19:05:43 2014 UTC vs.
Revision 1.19 by jsr166, Sun Sep 20 21:16:08 2015 UTC

# Line 14 | Line 14 | import junit.framework.TestSuite;
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 160 | Line 160 | public class SplittableRandomTest extend
160       */
161      public void testNextIntBounded() {
162          SplittableRandom sr = new SplittableRandom();
163 +        for (int i = 0; i < 2; i++) assertEquals(0, sr.nextInt(1));
164          // sample bound space across prime number increments
165          for (int bound = 2; bound < MAX_INT_BOUND; bound += 524959) {
166              int f = sr.nextInt(bound);
# Line 229 | Line 230 | public class SplittableRandomTest extend
230       */
231      public void testNextLongBounded() {
232          SplittableRandom sr = new SplittableRandom();
233 +        for (int i = 0; i < 2; i++) assertEquals(0L, sr.nextLong(1L));
234          for (long bound = 2; bound < MAX_LONG_BOUND; bound += 15485863) {
235              long f = sr.nextLong(bound);
236              assertTrue(0 <= f && f < bound);
# Line 410 | Line 412 | public class SplittableRandomTest extend
412          for (int least = -15485867; least < MAX_INT_BOUND; least += 524959) {
413              for (int bound = least + 2; bound > least && bound < MAX_INT_BOUND; bound += 67867967) {
414                  final int lo = least, hi = bound;
415 <                r.ints(size, lo, hi).parallel().
416 <                    forEach(x -> {if (x < lo || x >= hi)
417 <                                fails.getAndIncrement(); });
415 >                r.ints(size, lo, hi).parallel().forEach(
416 >                    x -> {
417 >                        if (x < lo || x >= hi)
418 >                            fails.getAndIncrement(); });
419              }
420          }
421          assertEquals(0, fails.get());
# Line 428 | Line 431 | public class SplittableRandomTest extend
431          for (long least = -86028121; least < MAX_LONG_BOUND; least += 1982451653L) {
432              for (long bound = least + 2; bound > least && bound < MAX_LONG_BOUND; bound += Math.abs(bound * 7919)) {
433                  final long lo = least, hi = bound;
434 <                r.longs(size, lo, hi).parallel().
435 <                    forEach(x -> {if (x < lo || x >= hi)
436 <                                fails.getAndIncrement(); });
434 >                r.longs(size, lo, hi).parallel().forEach(
435 >                    x -> {
436 >                        if (x < lo || x >= hi)
437 >                            fails.getAndIncrement(); });
438              }
439          }
440          assertEquals(0, fails.get());
# Line 446 | Line 450 | public class SplittableRandomTest extend
450          for (double least = 0.00011; least < 1.0e20; least *= 9) {
451              for (double bound = least * 1.0011; bound < 1.0e20; bound *= 17) {
452                  final double lo = least, hi = bound;
453 <                r.doubles(size, lo, hi).parallel().
454 <                    forEach(x -> {if (x < lo || x >= hi)
455 <                                fails.getAndIncrement(); });
453 >                r.doubles(size, lo, hi).parallel().forEach(
454 >                    x -> {
455 >                        if (x < lo || x >= hi)
456 >                            fails.getAndIncrement(); });
457              }
458          }
459          assertEquals(0, fails.get());

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines