--- jsr166/src/test/loops/IntegerSum.java 2013/02/28 11:41:56 1.1 +++ jsr166/src/test/loops/IntegerSum.java 2013/03/22 18:41:30 1.3 @@ -36,7 +36,7 @@ public class IntegerSum { } } - static String sep() { return print? "\n" : " "; } + static String sep() { return print ? "\n" : " "; } static void allTests(int size, int trials) throws Exception { System.out.println("---------------------------------------------"); @@ -74,8 +74,8 @@ public class IntegerSum { ctest(ConcurrentHashMap.newKeySet(), vlist, vsum, size, trials); ctest(new TreeSet(), klist, ksum, size, trials); ctest(new TreeSet(), vlist, vsum, size, trials); - ctest(ConcurrentSkipListMap.newKeySet(), klist, ksum, size, trials); - ctest(ConcurrentSkipListMap.newKeySet(), vlist, vsum, size, trials); + ctest(new ConcurrentSkipListSet(), klist, ksum, size, trials); + ctest(new ConcurrentSkipListSet(), vlist, vsum, size, trials); mtest(new HashMap(), keys, vals, ksum, vsum, size, trials); mtest(new IdentityHashMap(), keys, vals, ksum, vsum, size, trials); @@ -108,11 +108,10 @@ public class IntegerSum { ctest(new PriorityBlockingQueue(SIZE), vlist, vsum, size, trials); } - if (checksum.get() != 0) - throw new Error("bad computation"); + if (checksum.get() != 0) throw new Error("bad computation"); } - static void ctest(Collection c, List klist, int ksum, int size, int trials) + static void ctest(Collection c, List klist, int ksum, int size, int trials) throws Exception { String cn = c.getClass().getName(); if (cn.startsWith("java.util.concurrent.")) @@ -142,6 +141,7 @@ public class IntegerSum { long ti = itest(c, sum, trials); long ts = stest(c, sum, trials); long tp = ptest(c, sum, trials); + if (checksum.get() != 0) throw new Error("bad computation"); if (print) { long scale = (long)size * trials; double di = ((double)ti) / scale; @@ -160,7 +160,7 @@ public class IntegerSum { long tlast = System.nanoTime(); for (int i = 0; i < trials; ++i) { Integer psum = Integer.valueOf(checksum.get()); - for (Integer x : c) + for (Integer x : c) psum = SUM.apply(psum, x); checksum.getAndAdd(sum - psum); }