From b2055f2a1dd2117cdd05ab6596c38c82d3d05240 Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Thu, 11 Jun 2015 00:27:06 +1000 Subject: Report command lists more nicely (line breaks between commands); report number of nodes visited during shrinking; other small fixes --- .../java/au/id/zancanaro/javacheck/junit/Properties.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/main/java/au/id/zancanaro/javacheck/junit/Properties.java') diff --git a/src/main/java/au/id/zancanaro/javacheck/junit/Properties.java b/src/main/java/au/id/zancanaro/javacheck/junit/Properties.java index c428edc..175cd6c 100644 --- a/src/main/java/au/id/zancanaro/javacheck/junit/Properties.java +++ b/src/main/java/au/id/zancanaro/javacheck/junit/Properties.java @@ -116,26 +116,30 @@ public class Properties extends BlockJUnit4ClassRunner { private ShrinkResult shrink(ShrinkTree> failed, Throwable originalEx) { // this array is a mutable container so the shutdown handler can see the new version ShrinkResult[] smallest = new ShrinkResult[]{ - new ShrinkResult(failed.getValue(), originalEx)}; + new ShrinkResult(failed.getValue(), originalEx, 0, 0)}; Thread shutdownHandler = makeShutdownHandler(smallest, originalEx); Runtime.getRuntime().addShutdownHook(shutdownHandler); + int depth = 0; + int visited = 0; Set> seenArgs = new HashSet<>(); Iterator>> trees = failed.getChildren().iterator(); while (trees.hasNext()) { ShrinkTree> tree = trees.next(); List value = tree.getValue(); - boolean haveSeen = seenArgs.add(Arrays.asList(value)); - if (haveSeen) { + boolean notSeen = seenArgs.add(Arrays.asList(value)); + if (notSeen) { + visited++; try { runTest(value.toArray()); } catch (AssumptionViolatedException ex) { // ignore, because it's not useful } catch (Throwable ex) { - smallest[0] = new ShrinkResult(tree.getValue(), ex); + smallest[0] = new ShrinkResult(tree.getValue(), ex, depth, visited); Iterator>> children = tree.getChildren().iterator(); if (children.hasNext()) { + depth++; trees = children; } else { break; -- cgit v1.2.3