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

Comparing jsr166/src/test/tck/TimeUnitTest.java (file contents):
Revision 1.4 by dl, Sat Sep 20 18:20:08 2003 UTC vs.
Revision 1.5 by dl, Thu Sep 25 11:02:42 2003 UTC

# Line 20 | Line 20 | public class TimeUnitTest extends JSR166
20      }
21  
22      /**
23 <     *
23 >     * convert correctly converts sample values across the four units
24       */
25      public void testConvert() {
26          for (long t = 0; t < 10; ++t) {
# Line 76 | Line 76 | public class TimeUnitTest extends JSR166
76      }
77  
78      /**
79 <     *
79 >     * toNanos correctly converts sample values in different units to
80 >     * nanoseconds
81       */
82      public void testToNanos() {
83          for (long t = 0; t < 10; ++t) {
# Line 93 | Line 94 | public class TimeUnitTest extends JSR166
94      }
95  
96      /**
97 <     *
97 >     * toMicros correctly converts sample values in different units to
98 >     * microseconds
99       */
100      public void testToMicros() {
101          for (long t = 0; t < 10; ++t) {
# Line 110 | Line 112 | public class TimeUnitTest extends JSR166
112      }
113  
114      /**
115 <     *
115 >     * toMillis correctly converts sample values in different units to
116 >     * milliseconds
117       */
118      public void testToMillis() {
119          for (long t = 0; t < 10; ++t) {
# Line 127 | Line 130 | public class TimeUnitTest extends JSR166
130      }
131  
132      /**
133 <     *
133 >     * toSeconds correctly converts sample values in different units to
134 >     * seconds
135       */
136      public void testToSeconds() {
137          for (long t = 0; t < 10; ++t) {
# Line 145 | Line 149 | public class TimeUnitTest extends JSR166
149  
150  
151      /**
152 <     *
152 >     * convert saturates positive too-large values to Long.MAX_VALUE
153 >     * and negative to LONG.MIN_VALUE
154       */
155      public void testConvertSaturate() {
156          assertEquals(Long.MAX_VALUE,
# Line 154 | Line 159 | public class TimeUnitTest extends JSR166
159          assertEquals(Long.MIN_VALUE,
160                       TimeUnit.NANOSECONDS.convert(-Long.MAX_VALUE / 4,
161                                                    TimeUnit.SECONDS));
157
162      }
163  
164      /**
165 <     *
165 >     * toNanos saturates positive too-large values to Long.MAX_VALUE
166 >     * and negative to LONG.MIN_VALUE
167       */
168      public void testToNanosSaturate() {
169              assertEquals(Long.MAX_VALUE,
170                           TimeUnit.MILLISECONDS.toNanos(Long.MAX_VALUE / 2));
171              assertEquals(Long.MIN_VALUE,
172                           TimeUnit.MILLISECONDS.toNanos(-Long.MAX_VALUE / 3));
168            
173      }
174  
175  
176      /**
177 <     *
177 >     * toString returns string containing commn name of unit
178       */
179      public void testToString() {
180          String s = TimeUnit.SECONDS.toString();
# Line 182 | Line 186 | public class TimeUnitTest extends JSR166
186       *  Timed wait without holding lock throws
187       *  IllegalMonitorStateException
188       */
185    /**
186     *
187     */
189      public void testTimedWait_IllegalMonitorException() {
190          //created a new thread with anonymous runnable
191  
# Line 215 | Line 216 | public class TimeUnitTest extends JSR166
216      }
217      
218      /**
219 <     *   timedWait will throw InterruptedException.
219 <     *  Thread t waits on timedWait while the main thread interrupts it.
220 <     *  Note:  This does not throw IllegalMonitorException since timeWait
221 <     *         is synchronized on o
222 <     */
223 <    /**
224 <     *
219 >     * timedWait throws InterruptedException when interrupted
220       */
221      public void testTimedWait() {
222          Thread t = new Thread(new Runnable() {
# Line 253 | Line 248 | public class TimeUnitTest extends JSR166
248      
249      
250      /**
251 <     *   timedJoin will throw InterruptedException.
257 <     *  Thread t waits on timedJoin while the main thread interrupts it.
258 <     */
259 <    /**
260 <     *
251 >     * timedJoin throws InterruptedException when interrupted
252       */
253      public void testTimedJoin() {
254          Thread t = new Thread(new Runnable() {
# Line 289 | Line 280 | public class TimeUnitTest extends JSR166
280      }
281      
282      /**
283 <     *   timedSleep will throw InterruptedException.
293 <     *  Thread t waits on timedSleep while the main thread interrupts it.
294 <     */
295 <    /**
296 <     *
283 >     *  timedSleep throws InterruptedException when interrupted
284       */
285      public void testTimedSleep() {
286          //created a new thread with anonymous runnable
# Line 319 | Line 306 | public class TimeUnitTest extends JSR166
306      }
307  
308      /**
309 <     *
309 >     * a deserialized serialized unit is equal
310       */
311      public void testSerialization() {
312          TimeUnit q = TimeUnit.MILLISECONDS;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines