7 |
|
* @test |
8 |
|
* @synopsis Times and checks basic map operations |
9 |
|
*/ |
10 |
– |
import java.util.*; |
10 |
|
import java.io.*; |
11 |
+ |
import java.util.*; |
12 |
|
|
13 |
|
public class IntMapCheck { |
14 |
|
static int absentSize; |
34 |
|
} |
35 |
|
} |
36 |
|
|
37 |
– |
|
37 |
|
if (args.length > 1) |
38 |
|
numTests = Integer.parseInt(args[1]); |
39 |
|
|
67 |
|
|
68 |
|
TestTimer.printStats(); |
69 |
|
|
71 |
– |
|
70 |
|
if (doSerializeTest) |
71 |
|
stest(newMap(mapClass), size); |
72 |
|
} |
80 |
|
} |
81 |
|
} |
82 |
|
|
85 |
– |
|
83 |
|
static void runTest(Map<Integer,Integer> s, Integer[] key) { |
84 |
|
int size = key.length; |
85 |
|
long startTime = System.nanoTime(); |
112 |
|
reallyAssert(sum == expect * iters); |
113 |
|
} |
114 |
|
|
118 |
– |
|
115 |
|
static void t2(String nm, int n, Map<Integer,Integer> s, Integer[] key, int expect) { |
116 |
|
int sum = 0; |
117 |
|
timer.start(nm, n); |
186 |
|
reallyAssert(sum == expect); |
187 |
|
} |
188 |
|
|
193 |
– |
|
189 |
|
static void t9(Map<Integer,Integer> s) { |
190 |
|
int sum = 0; |
191 |
|
int iters = 20; |
197 |
|
reallyAssert(sum != 0); |
198 |
|
} |
199 |
|
|
205 |
– |
|
200 |
|
static void ktest(Map<Integer,Integer> s, int size, Integer[] key) { |
201 |
|
timer.start("ContainsKey ", size); |
202 |
|
Set ks = s.keySet(); |
208 |
|
reallyAssert(sum == size); |
209 |
|
} |
210 |
|
|
217 |
– |
|
211 |
|
static void ittest1(Map<Integer,Integer> s, int size) { |
212 |
|
int sum = 0; |
213 |
|
timer.start("Iter Key ", size); |
279 |
|
reallyAssert(s.size() == size); |
280 |
|
} |
281 |
|
|
289 |
– |
|
282 |
|
static void ittest(Map<Integer,Integer> s, int size) { |
283 |
|
for (int i = 0; i < 4; ++i) { |
284 |
|
ittest1(s, size); |
312 |
|
reallyAssert(sum == size); |
313 |
|
} |
314 |
|
|
323 |
– |
|
315 |
|
static void entest3(Hashtable ht, int size) { |
316 |
|
int sum = 0; |
317 |
|
|
390 |
|
reallyAssert(s.equals(m)); |
391 |
|
} |
392 |
|
|
402 |
– |
|
393 |
|
static void test(Map<Integer,Integer> s, Integer[] key) { |
394 |
|
int size = key.length; |
395 |
|
|
541 |
|
startTime = System.nanoTime(); |
542 |
|
} |
543 |
|
|
554 |
– |
|
544 |
|
String classify() { |
545 |
|
if (name.startsWith("Get")) |
546 |
|
return "Get "; |