let is_bad_data : ... -> bool
f data =
if is_bad_data data
then Crowbar.bad_test ()
else ... (* do test *)
let () =
Crowbar.add_test ~name:"test f" [generator] f
I mean if Crowbar.bad_test is hit some number of times, it would be better to fail at some point, to give feedback to the caller. At the time of writing, Crowbar doesn't terminate. For example Haskell's quickcheck does this, along the lines of giving up generating data after X trials and only Y successes.
As this is a breaking change (it could make tests that pass now (slowly though) fail), care should be taken regarding adoption.
If a test is too restrictive:
I mean if
Crowbar.bad_test
is hit some number of times, it would be better to fail at some point, to give feedback to the caller. At the time of writing,Crowbar
doesn't terminate. For example Haskell'squickcheck
does this, along the lines ofgiving up generating data after X trials and only Y successes
.As this is a breaking change (it could make tests that pass now (slowly though) fail), care should be taken regarding adoption.
Thanks for your work on crowbar ❤️