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

Comparing jsr166/src/test/tck/AtomicLongFieldUpdaterTest.java (file contents):
Revision 1.16 by jsr166, Sat Nov 21 17:38:05 2009 UTC vs.
Revision 1.21 by jsr166, Tue May 31 16:16:23 2011 UTC

# Line 1 | Line 1
1   /*
2   * Written by Doug Lea with assistance from members of JCP JSR-166
3   * Expert Group and released to the public domain, as explained at
4 < * http://creativecommons.org/licenses/publicdomain
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   * Other contributors include Andrew Wright, Jeffrey Hayes,
6   * Pat Fisher, Mike Judd.
7   */
8  
9 import java.util.concurrent.atomic.*;
9   import junit.framework.*;
10 < import java.util.*;
10 > import java.util.concurrent.atomic.AtomicLongFieldUpdater;
11  
12   public class AtomicLongFieldUpdaterTest extends JSR166TestCase {
13      volatile long x = 0;
# Line 59 | Line 58 | public class AtomicLongFieldUpdaterTest
58      }
59  
60      /**
61 <     *  get returns the last value set or assigned
61 >     * get returns the last value set or assigned
62       */
63      public void testGetSet() {
64          AtomicLongFieldUpdater<AtomicLongFieldUpdaterTest> a;
# Line 77 | Line 76 | public class AtomicLongFieldUpdaterTest
76      }
77  
78      /**
79 <     *  get returns the last value lazySet by same thread
79 >     * get returns the last value lazySet by same thread
80       */
81      public void testGetLazySet() {
82          AtomicLongFieldUpdater<AtomicLongFieldUpdaterTest> a;
# Line 94 | Line 93 | public class AtomicLongFieldUpdaterTest
93          assertEquals(-3,a.get(this));
94      }
95  
97
96      /**
97       * compareAndSet succeeds in changing value if equal to expected else fails
98       */
# Line 110 | Line 108 | public class AtomicLongFieldUpdaterTest
108          assertTrue(a.compareAndSet(this,2,-4));
109          assertEquals(-4,a.get(this));
110          assertFalse(a.compareAndSet(this,-5,7));
111 <        assertFalse((7 == a.get(this)));
111 >        assertEquals(-4,a.get(this));
112          assertTrue(a.compareAndSet(this,-4,7));
113          assertEquals(7,a.get(this));
114      }
115  
118
116      /**
117       * compareAndSet in one thread enables another waiting for value
118       * to succeed
# Line 162 | Line 159 | public class AtomicLongFieldUpdaterTest
159      }
160  
161      /**
162 <     *  getAndSet returns previous value and sets to given value
162 >     * getAndSet returns previous value and sets to given value
163       */
164      public void testGetAndSet() {
165          AtomicLongFieldUpdater<AtomicLongFieldUpdaterTest> a;
# Line 248 | Line 245 | public class AtomicLongFieldUpdaterTest
245      }
246  
247      /**
248 <     *  decrementAndGet decrements and returns current value
248 >     * decrementAndGet decrements and returns current value
249       */
250      public void testDecrementAndGet() {
251          AtomicLongFieldUpdater<AtomicLongFieldUpdaterTest> a;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines