From e9cf63e37d39b8e93b68c5cc6c915dd8a23e2bb4 Mon Sep 17 00:00:00 2001 From: nick_battle Date: Sun, 10 Nov 2024 20:34:48 +0000 Subject: [PATCH] Check for empty bindings after getValues --- .../src/main/java/quickcheck/QuickCheck.java | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/quickcheck/src/main/java/quickcheck/QuickCheck.java b/quickcheck/src/main/java/quickcheck/QuickCheck.java index 1e279c907..fac8004f6 100644 --- a/quickcheck/src/main/java/quickcheck/QuickCheck.java +++ b/quickcheck/src/main/java/quickcheck/QuickCheck.java @@ -542,6 +542,8 @@ else if (e.number == 4024) // 'not yet specified' expression reached String desc = ""; po.setWitness(null); po.setProvedBy(null); + po.setCounterexample(null); + po.setMessage(null); if (timedOut) { @@ -566,8 +568,17 @@ else if (po.isExistential()) else if (sresults.hasAllValues && execCompleted) { outcome = POStatus.PROVABLE; // All values were tested and passed, so PROVABLE - desc = " by finite types"; - po.setProvedBy("finite"); + + if (bindings.isEmpty()) + { + desc = " in all cases"; + po.setProvedBy("fixed"); + } + else + { + desc = " by finite types"; + po.setProvedBy("finite"); + } } else { @@ -576,8 +587,6 @@ else if (sresults.hasAllValues && execCompleted) infof(outcome, "PO #%d, %s%s %s\n", po.number, outcome.toString().toUpperCase(), desc, duration(before, after)); po.setStatus(outcome); - po.setCounterexample(null); - po.setMessage(null); } else { @@ -622,7 +631,16 @@ else if (globals.hasMaybe() && execCompleted) infof(POStatus.FAILED, "PO #%d, FAILED %s: ", po.number, duration(before, after)); po.setStatus(POStatus.FAILED); printCounterexample(bindings); - po.setCounterexample(globals.getCounterexample()); + + if (bindings.isEmpty()) // Failed with no binds - eg. Test() with no params + { + po.setCounterexample(new Context(po.location, "Empty", null)); + } + else + { + po.setCounterexample(globals.getCounterexample()); + } + po.setWitness(null); if (execException != null)