17 |
|
return new TestSuite(AtomicLongArrayTest.class); |
18 |
|
} |
19 |
|
|
20 |
+ |
/** |
21 |
+ |
* |
22 |
+ |
*/ |
23 |
|
public void testConstructor(){ |
24 |
|
AtomicLongArray ai = new AtomicLongArray(SIZE); |
25 |
|
for (int i = 0; i < SIZE; ++i) |
26 |
|
assertEquals(0,ai.get(i)); |
27 |
|
} |
28 |
|
|
29 |
+ |
/** |
30 |
+ |
* |
31 |
+ |
*/ |
32 |
|
public void testGetSet(){ |
33 |
|
AtomicLongArray ai = new AtomicLongArray(SIZE); |
34 |
|
for (int i = 0; i < SIZE; ++i) { |
41 |
|
} |
42 |
|
} |
43 |
|
|
44 |
+ |
/** |
45 |
+ |
* |
46 |
+ |
*/ |
47 |
|
public void testCompareAndSet(){ |
48 |
|
AtomicLongArray ai = new AtomicLongArray(SIZE); |
49 |
|
for (int i = 0; i < SIZE; ++i) { |
58 |
|
} |
59 |
|
} |
60 |
|
|
61 |
+ |
/** |
62 |
+ |
* |
63 |
+ |
*/ |
64 |
|
public void testWeakCompareAndSet(){ |
65 |
|
AtomicLongArray ai = new AtomicLongArray(SIZE); |
66 |
|
for (int i = 0; i < SIZE; ++i) { |
73 |
|
} |
74 |
|
} |
75 |
|
|
76 |
+ |
/** |
77 |
+ |
* |
78 |
+ |
*/ |
79 |
|
public void testGetAndSet(){ |
80 |
|
AtomicLongArray ai = new AtomicLongArray(SIZE); |
81 |
|
for (int i = 0; i < SIZE; ++i) { |
86 |
|
} |
87 |
|
} |
88 |
|
|
89 |
+ |
/** |
90 |
+ |
* |
91 |
+ |
*/ |
92 |
|
public void testGetAndAdd(){ |
93 |
|
AtomicLongArray ai = new AtomicLongArray(SIZE); |
94 |
|
for (int i = 0; i < SIZE; ++i) { |
100 |
|
} |
101 |
|
} |
102 |
|
|
103 |
+ |
/** |
104 |
+ |
* |
105 |
+ |
*/ |
106 |
|
public void testGetAndDecrement(){ |
107 |
|
AtomicLongArray ai = new AtomicLongArray(SIZE); |
108 |
|
for (int i = 0; i < SIZE; ++i) { |
113 |
|
} |
114 |
|
} |
115 |
|
|
116 |
+ |
/** |
117 |
+ |
* |
118 |
+ |
*/ |
119 |
|
public void testGetAndIncrement(){ |
120 |
|
AtomicLongArray ai = new AtomicLongArray(SIZE); |
121 |
|
for (int i = 0; i < SIZE; ++i) { |
130 |
|
} |
131 |
|
} |
132 |
|
|
133 |
+ |
/** |
134 |
+ |
* |
135 |
+ |
*/ |
136 |
|
public void testAddAndGet() { |
137 |
|
AtomicLongArray ai = new AtomicLongArray(SIZE); |
138 |
|
for (int i = 0; i < SIZE; ++i) { |
144 |
|
} |
145 |
|
} |
146 |
|
|
147 |
+ |
/** |
148 |
+ |
* |
149 |
+ |
*/ |
150 |
|
public void testDecrementAndGet(){ |
151 |
|
AtomicLongArray ai = new AtomicLongArray(SIZE); |
152 |
|
for (int i = 0; i < SIZE; ++i) { |
158 |
|
} |
159 |
|
} |
160 |
|
|
161 |
+ |
/** |
162 |
+ |
* |
163 |
+ |
*/ |
164 |
|
public void testIncrementAndGet() { |
165 |
|
AtomicLongArray ai = new AtomicLongArray(SIZE); |
166 |
|
for (int i = 0; i < SIZE; ++i) { |
199 |
|
} |
200 |
|
} |
201 |
|
|
202 |
+ |
/** |
203 |
+ |
* |
204 |
+ |
*/ |
205 |
|
public void testCountingInMultipleThreads() { |
206 |
|
try { |
207 |
|
final AtomicLongArray ai = new AtomicLongArray(SIZE); |
218 |
|
assertEquals(c1.counts+c2.counts, SIZE * COUNTDOWN); |
219 |
|
} |
220 |
|
catch(InterruptedException ie) { |
221 |
< |
fail("unexpected exception"); |
221 |
> |
unexpectedException(); |
222 |
|
} |
223 |
|
} |
224 |
|
|
225 |
+ |
/** |
226 |
+ |
* |
227 |
+ |
*/ |
228 |
|
public void testSerialization() { |
229 |
|
AtomicLongArray l = new AtomicLongArray(SIZE); |
230 |
|
for (int i = 0; i < SIZE; ++i) |
243 |
|
assertEquals(l.get(i), r.get(i)); |
244 |
|
} |
245 |
|
} catch(Exception e){ |
246 |
< |
e.printStackTrace(); |
208 |
< |
fail("unexpected exception"); |
246 |
> |
unexpectedException(); |
247 |
|
} |
248 |
|
} |
249 |
|
|