summaryrefslogtreecommitdiff
path: root/src/main/java/au/id/zancanaro/PropertyTestRunner.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/au/id/zancanaro/PropertyTestRunner.java')
-rw-r--r--src/main/java/au/id/zancanaro/PropertyTestRunner.java27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/main/java/au/id/zancanaro/PropertyTestRunner.java b/src/main/java/au/id/zancanaro/PropertyTestRunner.java
index b3563ff..ea36341 100644
--- a/src/main/java/au/id/zancanaro/PropertyTestRunner.java
+++ b/src/main/java/au/id/zancanaro/PropertyTestRunner.java
@@ -178,7 +178,7 @@ public class PropertyTestRunner extends BlockJUnit4ClassRunner {
runTest(tree.getValue());
assumptionsViolated = 0;
} catch (AssumptionViolatedException ex) {
- i--;
+ numTests++;
if (assumptionsViolated++ == 50) {
throw new Error("Violated 50 assumptions in a row: failing test");
}
@@ -193,19 +193,22 @@ public class PropertyTestRunner extends BlockJUnit4ClassRunner {
private ShrinkResult shrink(RoseTree<Object[]> failed, Throwable originalEx) {
ShrinkResult smallest = new ShrinkResult(failed.getValue(), originalEx);
Iterator<RoseTree<Object[]>> trees = failed.getChildren();
+ Set<List<Object>> seenArgs = new HashSet<>();
while (trees.hasNext()) {
RoseTree<Object[]> tree = trees.next();
- try {
- runTest(tree.getValue());
- } catch (AssumptionViolatedException ex) {
- // ignore, because it's not useful
- } catch (Throwable ex) {
- smallest = new ShrinkResult(tree.getValue(), ex);
- Iterator<RoseTree<Object[]>> children = tree.getChildren();
- if (children.hasNext()) {
- trees = children;
- } else {
- break;
+ if (seenArgs.add(Arrays.asList(tree.getValue()))) {
+ try {
+ runTest(tree.getValue());
+ } catch (AssumptionViolatedException ex) {
+ // ignore, because it's not useful
+ } catch (Throwable ex) {
+ smallest = new ShrinkResult(tree.getValue(), ex);
+ Iterator<RoseTree<Object[]>> children = tree.getChildren();
+ if (children.hasNext()) {
+ trees = children;
+ } else {
+ break;
+ }
}
}
}