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

Comparing jsr166/src/test/loops/IntMapCheck.java (file contents):
Revision 1.8 by jsr166, Tue Nov 3 01:04:02 2009 UTC vs.
Revision 1.9 by jsr166, Wed Sep 1 07:47:27 2010 UTC

# Line 99 | Line 99 | public class IntMapCheck {
99              }
100          }
101          timer.finish();
102 <        reallyAssert (sum == expect * iters);
102 >        reallyAssert(sum == expect * iters);
103      }
104  
105      static void t1Boxed(String nm, int n, Map<Integer,Integer> s, Integer[] key, int expect) {
# Line 112 | Line 112 | public class IntMapCheck {
112              }
113          }
114          timer.finish();
115 <        reallyAssert (sum == expect * iters);
115 >        reallyAssert(sum == expect * iters);
116      }
117  
118  
# Line 123 | Line 123 | public class IntMapCheck {
123              if (s.remove(key[i]) != null) ++sum;
124          }
125          timer.finish();
126 <        reallyAssert (sum == expect);
126 >        reallyAssert(sum == expect);
127      }
128  
129      static void t3(String nm, int n, Map<Integer,Integer> s, Integer[] key, int expect) {
# Line 135 | Line 135 | public class IntMapCheck {
135              if (s.put(k, v) == null) ++sum;
136          }
137          timer.finish();
138 <        reallyAssert (sum == expect);
138 >        reallyAssert(sum == expect);
139      }
140  
141      static void t4(String nm, int n, Map<Integer,Integer> s, Integer[] key, int expect) {
# Line 145 | Line 145 | public class IntMapCheck {
145              if (s.containsKey(key[i])) ++sum;
146          }
147          timer.finish();
148 <        reallyAssert (sum == expect);
148 >        reallyAssert(sum == expect);
149      }
150  
151      static void t5(String nm, int n, Map<Integer,Integer> s, Integer[] key, int expect) {
# Line 155 | Line 155 | public class IntMapCheck {
155              if (s.remove(key[i]) != null) ++sum;
156          }
157          timer.finish();
158 <        reallyAssert (sum == expect);
158 >        reallyAssert(sum == expect);
159      }
160  
161      static void t6(String nm, int n, Map<Integer,Integer> s, Integer[] k1, Integer[] k2) {
# Line 166 | Line 166 | public class IntMapCheck {
166              if (s.get(k2[i & absentMask]) != null) ++sum;
167          }
168          timer.finish();
169 <        reallyAssert (sum == n);
169 >        reallyAssert(sum == n);
170      }
171  
172      static void t7(String nm, int n, Map<Integer,Integer> s, Integer[] k1, Integer[] k2) {
# Line 177 | Line 177 | public class IntMapCheck {
177              if (s.containsKey(k2[i & absentMask])) ++sum;
178          }
179          timer.finish();
180 <        reallyAssert (sum == n);
180 >        reallyAssert(sum == n);
181      }
182  
183      static void t8(String nm, int n, Map<Integer,Integer> s, Integer[] key, int expect) {
# Line 187 | Line 187 | public class IntMapCheck {
187              if (s.get(key[i]) != null) ++sum;
188          }
189          timer.finish();
190 <        reallyAssert (sum == expect);
190 >        reallyAssert(sum == expect);
191      }
192  
193  
# Line 199 | Line 199 | public class IntMapCheck {
199          for (int i = 0; i < absentSize; i += step)
200              if (s.containsValue(absent[i])) ++sum;
201          timer.finish();
202 <        reallyAssert (sum != 0);
202 >        reallyAssert(sum != 0);
203      }
204  
205  
# Line 211 | Line 211 | public class IntMapCheck {
211              if (ks.contains(key[i])) ++sum;
212          }
213          timer.finish();
214 <        reallyAssert (sum == size);
214 >        reallyAssert(sum == size);
215      }
216  
217  
# Line 225 | Line 225 | public class IntMapCheck {
225          timer.finish();
226          //        if (sum != size)
227          //            System.out.println("iters " + sum + " size " + size);
228 <        reallyAssert (sum == size);
228 >        reallyAssert(sum == size);
229      }
230  
231      static void ittest2(Map<Integer,Integer> s, int size) {
# Line 238 | Line 238 | public class IntMapCheck {
238          timer.finish();
239          //        if (sum != size)
240          //            System.out.println("iters " + sum + " size " + size);
241 <        reallyAssert (sum == size);
241 >        reallyAssert(sum == size);
242      }
243      static void ittest3(Map<Integer,Integer> s, int size) {
244          int sum = 0;
# Line 248 | Line 248 | public class IntMapCheck {
248                  ++sum;
249          }
250          timer.finish();
251 <        reallyAssert (sum == size);
251 >        reallyAssert(sum == size);
252      }
253  
254      static void ittest4(Map<Integer,Integer> s, int size, int pos) {
255          IdentityHashMap seen = new IdentityHashMap(size);
256 <        reallyAssert (s.size() == size);
256 >        reallyAssert(s.size() == size);
257          int sum = 0;
258          timer.start("Iter XEntry            ", size);
259          Iterator it = s.entrySet().iterator();
# Line 267 | Line 267 | public class IntMapCheck {
267              if (v != MISSING)
268                  ++sum;
269          }
270 <        reallyAssert (s.containsKey(k));
270 >        reallyAssert(s.containsKey(k));
271          it.remove();
272 <        reallyAssert (!s.containsKey(k));
272 >        reallyAssert(!s.containsKey(k));
273          while (it.hasNext()) {
274              Map.Entry<Integer,Integer> x = (Map.Entry<Integer,Integer>)(it.next());
275              Integer k2 = x.getKey();
# Line 278 | Line 278 | public class IntMapCheck {
278                  ++sum;
279          }
280  
281 <        reallyAssert (s.size() == size-1);
281 >        reallyAssert(s.size() == size-1);
282          s.put(k, v);
283 <        reallyAssert (seen.size() == size);
283 >        reallyAssert(seen.size() == size);
284          timer.finish();
285 <        reallyAssert (sum == size);
286 <        reallyAssert (s.size() == size);
285 >        reallyAssert(sum == size);
286 >        reallyAssert(s.size() == size);
287      }
288  
289  
# Line 306 | Line 306 | public class IntMapCheck {
306                  ++sum;
307          }
308          timer.finish();
309 <        reallyAssert (sum == size);
309 >        reallyAssert(sum == size);
310      }
311  
312      static void entest2(Hashtable ht, int size) {
# Line 317 | Line 317 | public class IntMapCheck {
317                  ++sum;
318          }
319          timer.finish();
320 <        reallyAssert (sum == size);
320 >        reallyAssert(sum == size);
321      }
322  
323  
# Line 331 | Line 331 | public class IntMapCheck {
331                  ++sum;
332          }
333          timer.finish();
334 <        reallyAssert (sum == size);
334 >        reallyAssert(sum == size);
335      }
336  
337      static void entest4(Hashtable ht, int size) {
# Line 343 | Line 343 | public class IntMapCheck {
343                  ++sum;
344          }
345          timer.finish();
346 <        reallyAssert (sum == size);
346 >        reallyAssert(sum == size);
347      }
348  
349      static void entest(Map<Integer,Integer> s, int size) {
# Line 396 | Line 396 | public class IntMapCheck {
396          System.out.print(time + "ms");
397  
398          if (s instanceof IdentityHashMap) return;
399 <        reallyAssert (s.equals(m));
399 >        reallyAssert(s.equals(m));
400      }
401  
402  
# Line 459 | Line 459 | public class IntMapCheck {
459  
460          timer.start("Iter Equals            ", size * 2);
461          boolean eqt = s2.equals(s) && s.equals(s2);
462 <        reallyAssert (eqt);
462 >        reallyAssert(eqt);
463          timer.finish();
464  
465          timer.start("Iter HashCode          ", size * 2);
466          int shc = s.hashCode();
467          int s2hc = s2.hashCode();
468 <        reallyAssert (shc == s2hc);
468 >        reallyAssert(shc == s2hc);
469          timer.finish();
470  
471          timer.start("Put (present)          ", size * 2);
# Line 479 | Line 479 | public class IntMapCheck {
479              if (s2.put(me.getKey(), me.getValue()) != null)
480                  ++ipsum;
481          }
482 <        reallyAssert (ipsum == s.size());
482 >        reallyAssert(ipsum == s.size());
483          timer.finish();
484  
485          timer.start("Iter EntrySet contains ", size * 2);
# Line 490 | Line 490 | public class IntMapCheck {
490              if (es2.contains(entry)) ++sum;
491          }
492          timer.finish();
493 <        reallyAssert (sum == size);
493 >        reallyAssert(sum == size);
494  
495          Integer hold = s2.get(key[size-1]);
496          s2.put(key[size-1], absent[0]);
497          timer.start("Iter Equals            ", size * 2);
498          eqt = s2.equals(s) && s.equals(s2);
499 <        reallyAssert (!eqt);
499 >        reallyAssert(!eqt);
500          timer.finish();
501  
502          timer.start("Iter HashCode          ", size * 2);
503          int s1h = s.hashCode();
504          int s2h = s2.hashCode();
505 <        reallyAssert (s1h != s2h);
505 >        reallyAssert(s1h != s2h);
506          timer.finish();
507  
508          s2.put(key[size-1], hold);
# Line 513 | Line 513 | public class IntMapCheck {
513              reallyAssert(es.remove(s2i.next()));
514          timer.finish();
515  
516 <        reallyAssert (s.isEmpty());
516 >        reallyAssert(s.isEmpty());
517  
518          timer.start("Clear                  ", size);
519          s2.clear();
520          timer.finish();
521 <        reallyAssert (s2.isEmpty() && s.isEmpty());
521 >        reallyAssert(s2.isEmpty() && s.isEmpty());
522      }
523  
524      static class TestTimer {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines