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

Comparing jsr166/src/test/tck/ThreadLocalRandom8Test.java (file contents):
Revision 1.1 by jsr166, Fri Aug 16 07:07:01 2013 UTC vs.
Revision 1.5 by jsr166, Tue Sep 24 16:39:38 2013 UTC

# Line 6 | Line 6
6   import junit.framework.*;
7   import java.util.*;
8   import java.util.concurrent.ThreadLocalRandom;
9 import java.util.concurrent.atomic.AtomicLong;
9   import java.util.concurrent.atomic.AtomicInteger;
11 import java.util.concurrent.atomic.AtomicReference;
10   import java.util.concurrent.atomic.LongAdder;
11  
12   public class ThreadLocalRandom8Test extends JSR166TestCase {
# Line 21 | Line 19 | public class ThreadLocalRandom8Test exte
19      }
20  
21      // max sampled int bound
22 <    static final int MAX_INT_BOUND = (1 << 28);
22 >    static final int MAX_INT_BOUND = (1 << 26);
23  
24      // max sampled long bound
25      static final long MAX_LONG_BOUND = (1L << 42);
26  
27      // Number of replications for other checks
28 <    static final int REPS = 20;
28 >    static final int REPS =
29 >        Integer.getInteger("ThreadLocalRandom8Test.reps", 4);
30  
31      /**
32       * Invoking sized ints, long, doubles, with negative sizes throws
# Line 102 | Line 101 | public class ThreadLocalRandom8Test exte
101          long size = 0;
102          for (int reps = 0; reps < REPS; ++reps) {
103              counter.reset();
104 <            r.ints(size).parallel().forEach(x -> {counter.increment();});
104 >            r.ints(size).parallel().forEach(x -> counter.increment());
105              assertEquals(size, counter.sum());
106              size += 524959;
107          }
# Line 117 | Line 116 | public class ThreadLocalRandom8Test exte
116          long size = 0;
117          for (int reps = 0; reps < REPS; ++reps) {
118              counter.reset();
119 <            r.longs(size).parallel().forEach(x -> {counter.increment();});
119 >            r.longs(size).parallel().forEach(x -> counter.increment());
120              assertEquals(size, counter.sum());
121              size += 524959;
122          }
# Line 132 | Line 131 | public class ThreadLocalRandom8Test exte
131          long size = 0;
132          for (int reps = 0; reps < REPS; ++reps) {
133              counter.reset();
134 <            r.doubles(size).parallel().forEach(x -> {counter.increment();});
134 >            r.doubles(size).parallel().forEach(x -> counter.increment());
135              assertEquals(size, counter.sum());
136              size += 524959;
137          }
# Line 199 | Line 198 | public class ThreadLocalRandom8Test exte
198          LongAdder counter = new LongAdder();
199          ThreadLocalRandom r = ThreadLocalRandom.current();
200          long size = 100;
201 <        r.ints().limit(size).parallel().forEach(x -> {counter.increment();});
201 >        r.ints().limit(size).parallel().forEach(x -> counter.increment());
202          assertEquals(size, counter.sum());
203      }
204  
# Line 210 | Line 209 | public class ThreadLocalRandom8Test exte
209          LongAdder counter = new LongAdder();
210          ThreadLocalRandom r = ThreadLocalRandom.current();
211          long size = 100;
212 <        r.longs().limit(size).parallel().forEach(x -> {counter.increment();});
212 >        r.longs().limit(size).parallel().forEach(x -> counter.increment());
213          assertEquals(size, counter.sum());
214      }
215  
# Line 221 | Line 220 | public class ThreadLocalRandom8Test exte
220          LongAdder counter = new LongAdder();
221          ThreadLocalRandom r = ThreadLocalRandom.current();
222          long size = 100;
223 <        r.doubles().limit(size).parallel().forEach(x -> {counter.increment();});
223 >        r.doubles().limit(size).parallel().forEach(x -> counter.increment());
224          assertEquals(size, counter.sum());
225      }
226  
# Line 232 | Line 231 | public class ThreadLocalRandom8Test exte
231          LongAdder counter = new LongAdder();
232          ThreadLocalRandom r = ThreadLocalRandom.current();
233          long size = 100;
234 <        r.ints().limit(size).forEach(x -> {counter.increment();});
234 >        r.ints().limit(size).forEach(x -> counter.increment());
235          assertEquals(size, counter.sum());
236      }
237  
# Line 243 | Line 242 | public class ThreadLocalRandom8Test exte
242          LongAdder counter = new LongAdder();
243          ThreadLocalRandom r = ThreadLocalRandom.current();
244          long size = 100;
245 <        r.longs().limit(size).forEach(x -> {counter.increment();});
245 >        r.longs().limit(size).forEach(x -> counter.increment());
246          assertEquals(size, counter.sum());
247      }
248  
# Line 254 | Line 253 | public class ThreadLocalRandom8Test exte
253          LongAdder counter = new LongAdder();
254          ThreadLocalRandom r = ThreadLocalRandom.current();
255          long size = 100;
256 <        r.doubles().limit(size).forEach(x -> {counter.increment();});
256 >        r.doubles().limit(size).forEach(x -> counter.increment());
257          assertEquals(size, counter.sum());
258      }
259  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines