[cvs] / jsr166 / src / test / tck / AtomicIntegerArray9Test.java Repository:
ViewVC logotype

Diff of /jsr166/src/test/tck/AtomicIntegerArray9Test.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2, Wed Aug 24 22:22:39 2016 UTC revision 1.3, Tue Oct 11 20:38:07 2016 UTC
# Line 35  Line 35 
35                  () -> aa.compareAndExchange(j, 1, 2),                  () -> aa.compareAndExchange(j, 1, 2),
36                  () -> aa.compareAndExchangeAcquire(j, 1, 2),                  () -> aa.compareAndExchangeAcquire(j, 1, 2),
37                  () -> aa.compareAndExchangeRelease(j, 1, 2),                  () -> aa.compareAndExchangeRelease(j, 1, 2),
38                    () -> aa.weakCompareAndSetPlain(j, 1, 2),
39                  () -> aa.weakCompareAndSetVolatile(j, 1, 2),                  () -> aa.weakCompareAndSetVolatile(j, 1, 2),
40                  () -> aa.weakCompareAndSetAcquire(j, 1, 2),                  () -> aa.weakCompareAndSetAcquire(j, 1, 2),
41                  () -> aa.weakCompareAndSetRelease(j, 1, 2),                  () -> aa.weakCompareAndSetRelease(j, 1, 2),
# Line 189  Line 190 
190      }      }
191    
192      /**      /**
193         * repeated weakCompareAndSetPlain succeeds in changing value when equal
194         * to expected
195         */
196        public void testWeakCompareAndSetPlain() {
197            AtomicIntegerArray aa = new AtomicIntegerArray(SIZE);
198            for (int i = 0; i < SIZE; i++) {
199                aa.set(i, 1);
200                do {} while (!aa.weakCompareAndSetPlain(i, 1, 2));
201                do {} while (!aa.weakCompareAndSetPlain(i, 2, -4));
202                assertEquals(-4, aa.get(i));
203                do {} while (!aa.weakCompareAndSetPlain(i, -4, 7));
204                assertEquals(7, aa.get(i));
205            }
206        }
207    
208        /**
209       * repeated weakCompareAndSetVolatile succeeds in changing value when equal       * repeated weakCompareAndSetVolatile succeeds in changing value when equal
210       * to expected       * to expected
211       */       */

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

Doug Lea
ViewVC Help
Powered by ViewVC 1.0.8