Skip to content

Commit

Permalink
Clear PO counterexample/messages on re-runs
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbattle committed Oct 28, 2023
1 parent ba99ad8 commit ba820f4
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions examples/quickcheck/src/main/java/quickcheck/QuickCheck.java
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,8 @@ else if (results.provedBy != null)
{
po.setStatus(POStatus.PROVED);
po.setProvedBy(results.provedBy);
po.setCounterexample(null);
po.setCounterMessage(null);
printf("PO #%d, PROVED by %s strategy %s\n", po.number, results.provedBy, duration(results.duration));
return;
}
Expand Down Expand Up @@ -516,18 +518,24 @@ else if (results.hasAllValues)

printf("PO #%d, %s %s\n", po.number, outcome.toString().toUpperCase(), duration(before, after));
po.setStatus(outcome);
po.setCounterexample(null);
po.setCounterMessage(null);
}
else
{
if (didTimeout) // Result would have been true (above), but...
{
printf("PO #%d, TIMEOUT %s\n", po.number, duration(before, after));
po.setStatus(POStatus.TIMEOUT);
po.setCounterexample(null);
po.setCounterMessage(null);
}
else if (po.getCheckedExpression() instanceof TCExistsExpression)
{
printf("PO #%d, MAYBE %s\n", po.number, duration(before, after));
po.setStatus(POStatus.MAYBE);
po.setCounterexample(null);
po.setCounterMessage(null);
}
else
{
Expand All @@ -541,6 +549,10 @@ else if (po.getCheckedExpression() instanceof TCExistsExpression)
println(msg);
po.setCounterMessage(msg);
}
else
{
po.setCounterMessage(null);
}

println("----");
println(po);
Expand All @@ -552,6 +564,7 @@ else if (po.getCheckedExpression() instanceof TCExistsExpression)
String msg = String.format("Error: PO evaluation returns %s?\n", execResult.kind());
printf("PO #%d, %s\n", po.number, msg);
po.setStatus(POStatus.FAILED);
po.setCounterexample(null);
po.setCounterMessage(msg);
println("----");
printBindings(bindings);
Expand All @@ -564,6 +577,7 @@ else if (po.getCheckedExpression() instanceof TCExistsExpression)
String msg = String.format("Exception: %s", e.getMessage());
printf("PO #%d, %s\n", po.number, msg);
po.setStatus(POStatus.FAILED);
po.setCounterexample(null);
po.setCounterMessage(msg);
println("----");
printBindings(bindings);
Expand Down

0 comments on commit ba820f4

Please sign in to comment.