2 |
|
* Written by Doug Lea with assistance from members of JCP JSR-166 |
3 |
|
* Expert Group and released to the public domain, as explained at |
4 |
|
* http://creativecommons.org/licenses/publicdomain |
5 |
< |
* Other contributors include Andrew Wright, Jeffrey Hayes, |
6 |
< |
* Pat Fisher, Mike Judd. |
5 |
> |
* Other contributors include Andrew Wright, Jeffrey Hayes, |
6 |
> |
* Pat Fisher, Mike Judd. |
7 |
|
*/ |
8 |
|
|
9 |
|
import junit.framework.*; |
10 |
|
|
11 |
|
public class SystemTest extends JSR166TestCase { |
12 |
|
public static void main(String[] args) { |
13 |
< |
junit.textui.TestRunner.run(suite()); |
13 |
> |
junit.textui.TestRunner.run(suite()); |
14 |
|
} |
15 |
< |
|
15 |
> |
|
16 |
|
public static Test suite() { |
17 |
|
return new TestSuite(SystemTest.class); |
18 |
|
} |
19 |
|
|
20 |
< |
/** |
20 |
> |
/** |
21 |
|
* Worst case rounding for millisecs; set for 60 cycle millis clock. |
22 |
|
* This value might need to be changed os JVMs with coarser |
23 |
|
* System.currentTimeMillis clocks. |
65 |
|
long n2 = System.nanoTime(); |
66 |
|
long millis = m2 - m1; |
67 |
|
long nanos = n2 - n1; |
68 |
< |
|
68 |
> |
|
69 |
|
assertTrue(nanos >= 0); |
70 |
|
long nanosAsMillis = nanos / 1000000; |
71 |
|
assertTrue(millis <= nanosAsMillis + MILLIS_ROUND); |
76 |
|
} |
77 |
|
|
78 |
|
} |
79 |
– |
|