19 |
|
} |
20 |
|
|
21 |
|
|
22 |
< |
public void testConstructor(){ |
22 |
> |
/** |
23 |
> |
* |
24 |
> |
*/ |
25 |
> |
public void testConstructor() { |
26 |
|
AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); |
27 |
|
for (int i = 0; i < SIZE; ++i) |
28 |
|
assertEquals(0,ai.get(i)); |
29 |
|
} |
30 |
|
|
31 |
< |
public void testGetSet(){ |
31 |
> |
/** |
32 |
> |
* |
33 |
> |
*/ |
34 |
> |
public void testGetSet() { |
35 |
|
AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); |
36 |
|
for (int i = 0; i < SIZE; ++i) { |
37 |
|
ai.set(i, 1); |
43 |
|
} |
44 |
|
} |
45 |
|
|
46 |
< |
public void testCompareAndSet(){ |
46 |
> |
/** |
47 |
> |
* |
48 |
> |
*/ |
49 |
> |
public void testCompareAndSet() { |
50 |
|
AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); |
51 |
|
for (int i = 0; i < SIZE; ++i) { |
52 |
|
ai.set(i, 1); |
60 |
|
} |
61 |
|
} |
62 |
|
|
63 |
< |
public void testWeakCompareAndSet(){ |
63 |
> |
/** |
64 |
> |
* |
65 |
> |
*/ |
66 |
> |
public void testWeakCompareAndSet() { |
67 |
|
AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); |
68 |
|
for (int i = 0; i < SIZE; ++i) { |
69 |
|
ai.set(i, 1); |
75 |
|
} |
76 |
|
} |
77 |
|
|
78 |
< |
public void testGetAndSet(){ |
78 |
> |
/** |
79 |
> |
* |
80 |
> |
*/ |
81 |
> |
public void testGetAndSet() { |
82 |
|
AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); |
83 |
|
for (int i = 0; i < SIZE; ++i) { |
84 |
|
ai.set(i, 1); |
88 |
|
} |
89 |
|
} |
90 |
|
|
91 |
< |
public void testGetAndAdd(){ |
91 |
> |
/** |
92 |
> |
* |
93 |
> |
*/ |
94 |
> |
public void testGetAndAdd() { |
95 |
|
AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); |
96 |
|
for (int i = 0; i < SIZE; ++i) { |
97 |
|
ai.set(i, 1); |
102 |
|
} |
103 |
|
} |
104 |
|
|
105 |
< |
public void testGetAndDecrement(){ |
105 |
> |
/** |
106 |
> |
* |
107 |
> |
*/ |
108 |
> |
public void testGetAndDecrement() { |
109 |
|
AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); |
110 |
|
for (int i = 0; i < SIZE; ++i) { |
111 |
|
ai.set(i, 1); |
115 |
|
} |
116 |
|
} |
117 |
|
|
118 |
< |
public void testGetAndIncrement(){ |
118 |
> |
/** |
119 |
> |
* |
120 |
> |
*/ |
121 |
> |
public void testGetAndIncrement() { |
122 |
|
AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); |
123 |
|
for (int i = 0; i < SIZE; ++i) { |
124 |
|
ai.set(i, 1); |
132 |
|
} |
133 |
|
} |
134 |
|
|
135 |
+ |
/** |
136 |
+ |
* |
137 |
+ |
*/ |
138 |
|
public void testAddAndGet() { |
139 |
|
AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); |
140 |
|
for (int i = 0; i < SIZE; ++i) { |
146 |
|
} |
147 |
|
} |
148 |
|
|
149 |
< |
public void testDecrementAndGet(){ |
149 |
> |
/** |
150 |
> |
* |
151 |
> |
*/ |
152 |
> |
public void testDecrementAndGet() { |
153 |
|
AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); |
154 |
|
for (int i = 0; i < SIZE; ++i) { |
155 |
|
ai.set(i, 1); |
160 |
|
} |
161 |
|
} |
162 |
|
|
163 |
+ |
/** |
164 |
+ |
* |
165 |
+ |
*/ |
166 |
|
public void testIncrementAndGet() { |
167 |
|
AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); |
168 |
|
for (int i = 0; i < SIZE; ++i) { |
201 |
|
} |
202 |
|
} |
203 |
|
|
204 |
+ |
/** |
205 |
+ |
* |
206 |
+ |
*/ |
207 |
|
public void testCountingInMultipleThreads() { |
208 |
|
try { |
209 |
|
final AtomicIntegerArray ai = new AtomicIntegerArray(SIZE); |
220 |
|
assertEquals(c1.counts+c2.counts, SIZE * COUNTDOWN); |
221 |
|
} |
222 |
|
catch(InterruptedException ie) { |
223 |
< |
fail("unexpected exception"); |
223 |
> |
unexpectedException(); |
224 |
|
} |
225 |
|
} |
226 |
|
|
227 |
|
|
228 |
+ |
/** |
229 |
+ |
* |
230 |
+ |
*/ |
231 |
|
public void testSerialization() { |
232 |
|
AtomicIntegerArray l = new AtomicIntegerArray(SIZE); |
233 |
|
for (int i = 0; i < SIZE; ++i) |
247 |
|
} |
248 |
|
} catch(Exception e){ |
249 |
|
e.printStackTrace(); |
250 |
< |
fail("unexpected exception"); |
250 |
> |
unexpectedException(); |
251 |
|
} |
252 |
|
} |
253 |
|
|