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

Comparing jsr166/src/test/tck/PhaserTest.java (file contents):
Revision 1.33 by jsr166, Wed Jun 22 07:46:57 2011 UTC vs.
Revision 1.36 by jsr166, Fri Nov 18 20:11:17 2011 UTC

# Line 165 | Line 165 | public class PhaserTest extends JSR166Te
165      }
166  
167      /**
168 <     * register() correctly returns the current barrier phase number when
169 <     * invoked
168 >     * register() correctly returns the current barrier phase number
169 >     * when invoked
170       */
171      public void testRegister3() {
172          Phaser phaser = new Phaser();
# Line 177 | Line 177 | public class PhaserTest extends JSR166Te
177      }
178  
179      /**
180 <     * register causes the next arrive to not increment the phase rather retain
181 <     * the phase number
180 >     * register causes the next arrive to not increment the phase
181 >     * rather retain the phase number
182       */
183      public void testRegister4() {
184          Phaser phaser = new Phaser(1);
# Line 189 | Line 189 | public class PhaserTest extends JSR166Te
189      }
190  
191      /**
192 +     * register on a subphaser that is currently empty succeeds, even
193 +     * in the presence of another non-empty subphaser
194 +     */
195 +    public void testRegisterEmptySubPhaser() {
196 +        Phaser root = new Phaser();
197 +        Phaser child1 = new Phaser(root, 1);
198 +        Phaser child2 = new Phaser(root, 0);
199 +        assertEquals(0, child2.register());
200 +        assertState(root, 0, 2, 2);
201 +        assertState(child1, 0, 1, 1);
202 +        assertState(child2, 0, 1, 1);
203 +        assertEquals(0, child2.arriveAndDeregister());
204 +        assertState(root, 0, 1, 1);
205 +        assertState(child1, 0, 1, 1);
206 +        assertState(child2, 0, 0, 0);
207 +        assertEquals(0, child2.register());
208 +        assertEquals(0, child2.arriveAndDeregister());
209 +        assertState(root, 0, 1, 1);
210 +        assertState(child1, 0, 1, 1);
211 +        assertState(child2, 0, 0, 0);
212 +        assertEquals(0, child1.arriveAndDeregister());
213 +        assertTerminated(root, 1);
214 +        assertTerminated(child1, 1);
215 +        assertTerminated(child2, 1);
216 +    }
217 +
218 +    /**
219       * Invoking bulkRegister with a negative parameter throws an
220       * IllegalArgumentException
221       */
# Line 200 | Line 227 | public class PhaserTest extends JSR166Te
227      }
228  
229      /**
230 <     * bulkRegister should correctly record the number of unarrived parties with
231 <     * the number of parties being registered
230 >     * bulkRegister should correctly record the number of unarrived
231 >     * parties with the number of parties being registered
232       */
233      public void testBulkRegister2() {
234          Phaser phaser = new Phaser();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines