4 |
|
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
*/ |
6 |
|
|
7 |
< |
import junit.framework.*; |
8 |
< |
import java.util.concurrent.*; |
7 |
> |
import java.util.concurrent.Executors; |
8 |
> |
import java.util.concurrent.ExecutorService; |
9 |
> |
import java.util.concurrent.Phaser; |
10 |
|
import java.util.concurrent.atomic.LongAccumulator; |
11 |
|
|
12 |
+ |
import junit.framework.Test; |
13 |
+ |
import junit.framework.TestSuite; |
14 |
+ |
|
15 |
|
public class LongAccumulatorTest extends JSR166TestCase { |
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(LongAccumulatorTest.class); |
42 |
|
} |
43 |
|
|
44 |
|
/** |
45 |
< |
* reset zeroes get |
45 |
> |
* reset() causes subsequent get() to return zero |
46 |
|
*/ |
47 |
|
public void testReset() { |
48 |
|
LongAccumulator ai = new LongAccumulator(Long::max, 0L); |
53 |
|
} |
54 |
|
|
55 |
|
/** |
56 |
< |
* getThenReset returns get then zeros |
56 |
> |
* getThenReset() returns current value; subsequent get() returns zero |
57 |
|
*/ |
58 |
|
public void testGetThenReset() { |
59 |
|
LongAccumulator ai = new LongAccumulator(Long::max, 0L); |