186
187 System.out.printf("doneCount=%d%n", doneCount.get());
188 System.out.printf("setCount=%d%n", setCount.get());
189 System.out.printf("setExceptionCount=%d%n", setExceptionCount.get());
190 }
191
192 //--------------------- Infrastructure ---------------------------
193 static volatile int passed = 0, failed = 0;
194 static void pass() {passed++;}
195 static void fail() {failed++; Thread.dumpStack();}
196 static void fail(String msg) {System.out.println(msg); fail();}
197 static void unexpected(Throwable t) {failed++; t.printStackTrace();}
198 static void check(boolean cond) {if (cond) pass(); else fail();}
199 static void equal(Object x, Object y) {
200 if (x == null ? y == null : x.equals(y)) pass();
201 else fail(x + " not equal to " + y);}
202 public static void main(String[] args) throws Throwable {
203 try {realMain(args);} catch (Throwable t) {unexpected(t);}
204 System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
205 if (failed > 0) throw new AssertionError("Some tests failed");}
206 private static abstract class Fun {abstract void f() throws Throwable;}
207 static void THROWS(Class<? extends Throwable> k, Fun... fs) {
208 for (Fun f : fs)
209 try { f.f(); fail("Expected " + k.getName() + " not thrown"); }
210 catch (Throwable t) {
211 if (k.isAssignableFrom(t.getClass())) pass();
212 else unexpected(t);}}
213 }
|
186
187 System.out.printf("doneCount=%d%n", doneCount.get());
188 System.out.printf("setCount=%d%n", setCount.get());
189 System.out.printf("setExceptionCount=%d%n", setExceptionCount.get());
190 }
191
192 //--------------------- Infrastructure ---------------------------
193 static volatile int passed = 0, failed = 0;
194 static void pass() {passed++;}
195 static void fail() {failed++; Thread.dumpStack();}
196 static void fail(String msg) {System.out.println(msg); fail();}
197 static void unexpected(Throwable t) {failed++; t.printStackTrace();}
198 static void check(boolean cond) {if (cond) pass(); else fail();}
199 static void equal(Object x, Object y) {
200 if (x == null ? y == null : x.equals(y)) pass();
201 else fail(x + " not equal to " + y);}
202 public static void main(String[] args) throws Throwable {
203 try {realMain(args);} catch (Throwable t) {unexpected(t);}
204 System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
205 if (failed > 0) throw new AssertionError("Some tests failed");}
206 private abstract static class Fun {abstract void f() throws Throwable;}
207 static void THROWS(Class<? extends Throwable> k, Fun... fs) {
208 for (Fun f : fs)
209 try { f.f(); fail("Expected " + k.getName() + " not thrown"); }
210 catch (Throwable t) {
211 if (k.isAssignableFrom(t.getClass())) pass();
212 else unexpected(t);}}
213 }
|