jobjo / popper

Property-based testing at ease
ISC License
43 stars 1 forks source link

Improve handling of discarded tests #50

Closed jobjo closed 3 years ago

jobjo commented 3 years ago

A few things:

1) Add a configuration max_num_discarded for specifying that a property-based test fails if it exceeds the threshold for the number of discarded items.

2) Expose missing Popper.discard function.

3) Improve printing of discarded unit test.

4) Change the number of samples for the test target to 1000.

Example:

let config = Config.max_num_discarded 50
let () =
  check ~config (fun () ->
    let* b = Sample.bool in
    if b then pass else discard)

Results in:

image