1 |
|
/* |
2 |
|
* Written by Josh Bloch of Google Inc. and released to the public domain, |
3 |
< |
* as explained at http://creativecommons.org/licenses/publicdomain. |
3 |
> |
* as explained at http://creativecommons.org/publicdomain/zero/1.0/. |
4 |
|
*/ |
5 |
|
|
6 |
– |
import java.util.*; |
6 |
|
import java.io.*; |
7 |
+ |
import java.util.*; |
8 |
|
|
9 |
|
/** |
10 |
|
* Interface-based Deque tester. This test currently makes three |
22 |
|
static int nextHead = -1; |
23 |
|
static int size() { return nextTail - nextHead - 1; } |
24 |
|
|
25 |
– |
|
25 |
|
static int random(int bound) { |
26 |
|
int x = seed; |
27 |
|
int t = (x % 127773) * 16807 - (x / 127773) * 2836; |
36 |
|
return (t & 0x7fffffff); |
37 |
|
} |
38 |
|
|
39 |
< |
public static void main(String args[]) throws Exception { |
39 |
> |
public static void main(String[] args) throws Exception { |
40 |
|
Class<?> cls = Class.forName(args[0]); |
41 |
|
int n = 1000000; |
42 |
|
|
52 |
|
System.out.printf("Time: %d ms%n", elapsedTimeMillis); |
53 |
|
if (deque.isEmpty()) System.out.print(" "); |
54 |
|
} |
56 |
– |
|
55 |
|
} |
56 |
|
|
57 |
|
static void mainTest(Deque<Integer> deque, int n) throws Exception { |
78 |
|
// Test fancy removal stuff once in a blue moon |
79 |
|
if ((i & 8191) == 0) |
80 |
|
testRemove(deque); |
81 |
< |
|
84 |
< |
} |
81 |
> |
} |
82 |
|
|
83 |
|
// Stupid tests for clear, toString |
84 |
|
deque.clear(); |
151 |
|
deque.getLast() + " expecting " + (nextTail - 1)); |
152 |
|
} |
153 |
|
|
157 |
– |
|
154 |
|
static void randomOp(Deque<Integer> deque) throws Exception { |
155 |
|
|
156 |
|
// Perform a random operation |
227 |
|
} |
228 |
|
} |
229 |
|
|
234 |
– |
|
230 |
|
private static void testEqual(Deque<Integer> d1, Deque<Integer> d2) |
231 |
|
throws Exception |
232 |
|
{ |