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

Comparing jsr166/src/test/tck/AtomicLongTest.java (file contents):
Revision 1.3 by dl, Sun Sep 14 20:42:40 2003 UTC vs.
Revision 1.4 by dl, Sat Sep 20 18:20:07 2003 UTC

# Line 17 | Line 17 | public class AtomicLongTest extends JSR1
17          return new TestSuite(AtomicLongTest.class);
18      }
19  
20 +    /**
21 +     *
22 +     */
23      public void testConstructor(){
24          AtomicLong ai = new AtomicLong(1);
25          assertEquals(1,ai.get());
26      }
27  
28 +    /**
29 +     *
30 +     */
31      public void testConstructor2(){
32          AtomicLong ai = new AtomicLong();
33          assertEquals(0,ai.get());
34      }
35  
36 +    /**
37 +     *
38 +     */
39      public void testGetSet(){
40          AtomicLong ai = new AtomicLong(1);
41          assertEquals(1,ai.get());
# Line 36 | Line 45 | public class AtomicLongTest extends JSR1
45          assertEquals(-3,ai.get());
46          
47      }
48 +    /**
49 +     *
50 +     */
51      public void testCompareAndSet(){
52          AtomicLong ai = new AtomicLong(1);
53          assertTrue(ai.compareAndSet(1,2));
# Line 47 | Line 59 | public class AtomicLongTest extends JSR1
59          assertEquals(7,ai.get());
60      }
61  
62 +    /**
63 +     *
64 +     */
65      public void testWeakCompareAndSet(){
66          AtomicLong ai = new AtomicLong(1);
67          while(!ai.weakCompareAndSet(1,2));
# Line 56 | Line 71 | public class AtomicLongTest extends JSR1
71          assertEquals(7,ai.get());
72      }
73  
74 +    /**
75 +     *
76 +     */
77      public void testGetAndSet(){
78          AtomicLong ai = new AtomicLong(1);
79          assertEquals(1,ai.getAndSet(0));
# Line 63 | Line 81 | public class AtomicLongTest extends JSR1
81          assertEquals(-10,ai.getAndSet(1));
82      }
83  
84 +    /**
85 +     *
86 +     */
87      public void testGetAndAdd(){
88          AtomicLong ai = new AtomicLong(1);
89          assertEquals(1,ai.getAndAdd(2));
# Line 71 | Line 92 | public class AtomicLongTest extends JSR1
92          assertEquals(-1,ai.get());
93      }
94  
95 +    /**
96 +     *
97 +     */
98      public void testGetAndDecrement(){
99          AtomicLong ai = new AtomicLong(1);
100          assertEquals(1,ai.getAndDecrement());
# Line 78 | Line 102 | public class AtomicLongTest extends JSR1
102          assertEquals(-1,ai.getAndDecrement());
103      }
104  
105 +    /**
106 +     *
107 +     */
108      public void testGetAndIncrement(){
109          AtomicLong ai = new AtomicLong(1);
110          assertEquals(1,ai.getAndIncrement());
# Line 89 | Line 116 | public class AtomicLongTest extends JSR1
116          assertEquals(1,ai.get());
117      }
118  
119 +    /**
120 +     *
121 +     */
122      public void testAddAndGet(){
123          AtomicLong ai = new AtomicLong(1);
124          assertEquals(3,ai.addAndGet(2));
# Line 97 | Line 127 | public class AtomicLongTest extends JSR1
127          assertEquals(-1,ai.get());
128      }
129  
130 +    /**
131 +     *
132 +     */
133      public void testDecrementAndGet(){
134          AtomicLong ai = new AtomicLong(1);
135          assertEquals(0,ai.decrementAndGet());
# Line 105 | Line 138 | public class AtomicLongTest extends JSR1
138          assertEquals(-2,ai.get());
139      }
140  
141 +    /**
142 +     *
143 +     */
144      public void testIncrementAndGet(){
145          AtomicLong ai = new AtomicLong(1);
146          assertEquals(2,ai.incrementAndGet());
# Line 116 | Line 152 | public class AtomicLongTest extends JSR1
152          assertEquals(1,ai.get());
153      }
154  
155 +    /**
156 +     *
157 +     */
158      public void testSerialization() {
159          AtomicLong l = new AtomicLong();
160  
# Line 131 | Line 170 | public class AtomicLongTest extends JSR1
170              AtomicLong r = (AtomicLong) in.readObject();
171              assertEquals(l.get(), r.get());
172          } catch(Exception e){
173 <            e.printStackTrace();
135 <            fail("unexpected exception");
173 >            unexpectedException();
174          }
175      }
176  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines