9 |
|
|
10 |
|
public class SystemTest extends JSR166TestCase { |
11 |
|
public static void main(String[] args) { |
12 |
< |
junit.textui.TestRunner.run(suite()); |
12 |
> |
junit.textui.TestRunner.run(suite()); |
13 |
|
} |
14 |
|
|
15 |
|
public static Test suite() { |
16 |
< |
return new TestSuite(SystemTest.class); |
16 |
> |
return new TestSuite(SystemTest.class); |
17 |
|
} |
18 |
|
|
19 |
|
/** |
20 |
< |
* Nanos between readings of millis is no longer than millis. |
20 |
> |
* Nanos between readings of millis is no longer than millis (plus |
21 |
> |
* one milli to allow for rounding). |
22 |
|
* This shows only that nano timing not (much) worse than milli. |
23 |
|
*/ |
24 |
|
public void testNanoTime1() { |
34 |
|
long nanos = n2 - n1; |
35 |
|
|
36 |
|
assertTrue(nanos >= 0); |
37 |
< |
assertTrue(nanos <= millis * 1000000); |
37 |
> |
assertTrue(nanos < (millis+1) * 1000000); |
38 |
|
} |
39 |
|
catch(InterruptedException ie) { |
40 |
|
unexpectedException(); |