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

Comparing jsr166/src/test/tck/AtomicReferenceArray9Test.java (file contents):
Revision 1.2 by jsr166, Wed Aug 24 22:22:39 2016 UTC vs.
Revision 1.3 by jsr166, Tue Oct 11 20:38:07 2016 UTC

# Line 34 | Line 34 | public class AtomicReferenceArray9Test e
34                  () -> aa.compareAndExchange(j, null, null),
35                  () -> aa.compareAndExchangeAcquire(j, null, null),
36                  () -> aa.compareAndExchangeRelease(j, null, null),
37 +                () -> aa.weakCompareAndSetPlain(j, null, null),
38                  () -> aa.weakCompareAndSetVolatile(j, null, null),
39                  () -> aa.weakCompareAndSetAcquire(j, null, null),
40                  () -> aa.weakCompareAndSetRelease(j, null, null),
# Line 186 | Line 187 | public class AtomicReferenceArray9Test e
187              assertEquals(seven, aa.get(i));
188          }
189      }
190 +
191 +    /**
192 +     * repeated weakCompareAndSetPlain succeeds in changing value when equal
193 +     * to expected
194 +     */
195 +    public void testWeakCompareAndSetPlain() {
196 +        AtomicReferenceArray<Integer> aa = new AtomicReferenceArray<>(SIZE);
197 +        for (int i = 0; i < SIZE; i++) {
198 +            aa.set(i, one);
199 +            do {} while (!aa.weakCompareAndSetPlain(i, one, two));
200 +            do {} while (!aa.weakCompareAndSetPlain(i, two, m4));
201 +            assertEquals(m4, aa.get(i));
202 +            do {} while (!aa.weakCompareAndSetPlain(i, m4, seven));
203 +            assertEquals(seven, aa.get(i));
204 +        }
205 +    }
206  
207      /**
208       * repeated weakCompareAndSetVolatile succeeds in changing value when equal

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines