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

Comparing jsr166/src/test/tck/LongAccumulatorTest.java (file contents):
Revision 1.5 by jsr166, Sat Apr 25 04:55:31 2015 UTC vs.
Revision 1.7 by jsr166, Sun Apr 23 03:03:16 2017 UTC

# Line 21 | Line 21 | public class LongAccumulatorTest extends
21      }
22  
23      /**
24 <     * default constructed initializes to zero
24 >     * new instance initialized to supplied identity
25       */
26      public void testConstructor() {
27 <        LongAccumulator ai = new LongAccumulator(Long::max, 0L);
28 <        assertEquals(0, ai.get());
27 >        for (long identity : new long[] { Long.MIN_VALUE, 0, Long.MAX_VALUE })
28 >            assertEquals(identity,
29 >                         new LongAccumulator(Long::max, identity).get());
30      }
31  
32      /**
# Line 42 | Line 43 | public class LongAccumulatorTest extends
43      }
44  
45      /**
46 <     * reset zeroes get
46 >     * reset() causes subsequent get() to return zero
47       */
48      public void testReset() {
49          LongAccumulator ai = new LongAccumulator(Long::max, 0L);
# Line 53 | Line 54 | public class LongAccumulatorTest extends
54      }
55  
56      /**
57 <     * getThenReset returns get then zeros
57 >     * getThenReset() returns current value; subsequent get() returns zero
58       */
59      public void testGetThenReset() {
60          LongAccumulator ai = new LongAccumulator(Long::max, 0L);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines