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

Comparing jsr166/src/test/tck/AtomicStampedReferenceTest.java (file contents):
Revision 1.19 by jsr166, Fri Jun 10 20:01:21 2011 UTC vs.
Revision 1.23 by jsr166, Sat Apr 25 04:55:30 2015 UTC

# Line 6 | Line 6
6   * Pat Fisher, Mike Judd.
7   */
8  
9 import junit.framework.*;
9   import java.util.concurrent.atomic.AtomicStampedReference;
10  
11 + import junit.framework.Test;
12 + import junit.framework.TestSuite;
13 +
14   public class AtomicStampedReferenceTest extends JSR166TestCase {
15      public static void main(String[] args) {
16 <        junit.textui.TestRunner.run(suite());
16 >        main(suite(), args);
17      }
18      public static Test suite() {
19          return new TestSuite(AtomicStampedReferenceTest.class);
# Line 104 | Line 106 | public class AtomicStampedReferenceTest
106          assertTrue(ai.compareAndSet(one, two, 0, 0));
107          t.join(LONG_DELAY_MS);
108          assertFalse(t.isAlive());
109 <        assertSame(ai.getReference(), three);
110 <        assertEquals(ai.getStamp(), 0);
109 >        assertSame(three, ai.getReference());
110 >        assertEquals(0, ai.getStamp());
111      }
112  
113      /**
# Line 124 | Line 126 | public class AtomicStampedReferenceTest
126          assertTrue(ai.compareAndSet(one, one, 0, 1));
127          t.join(LONG_DELAY_MS);
128          assertFalse(t.isAlive());
129 <        assertSame(ai.getReference(), one);
130 <        assertEquals(ai.getStamp(), 2);
129 >        assertSame(one, ai.getReference());
130 >        assertEquals(2, ai.getStamp());
131      }
132  
133      /**
# Line 139 | Line 141 | public class AtomicStampedReferenceTest
141          assertEquals(0, ai.getStamp());
142          assertEquals(0, mark[0]);
143  
144 <        while (!ai.weakCompareAndSet(one, two, 0, 0));
144 >        do {} while (!ai.weakCompareAndSet(one, two, 0, 0));
145          assertSame(two, ai.get(mark));
146          assertEquals(0, mark[0]);
147  
148 <        while (!ai.weakCompareAndSet(two, m3, 0, 1));
148 >        do {} while (!ai.weakCompareAndSet(two, m3, 0, 1));
149          assertSame(m3, ai.get(mark));
150          assertEquals(1, mark[0]);
151      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines