qcheck icon indicating copy to clipboard operation
qcheck copied to clipboard

Is _opt_map_n relevant for printers ?

Open vch9 opened this issue 4 years ago • 3 comments

For instance:

# open QCheck;;
# let arb = pair small_int (always 0);;
val arb : (int * int) QCheck.arbitrary =
  {gen = <fun>; print = None; small = None; shrink = Some <fun>;
   collect = None; stats = []}

We could have the printer print (n, <no-printer>)? This could still be useful.

vch9 avatar Dec 03 '21 10:12 vch9

I noticed the behavior while providing printers for #181

vch9 avatar Dec 03 '21 10:12 vch9

What I propose is very similar to what you did for shrinkers:

let quad =
  ...
  ~shrink:(Shrink.quad
                   (_opt_or a.shrink Shrink.nil)
                   (_opt_or b.shrink Shrink.nil)
                   (_opt_or c.shrink Shrink.nil)
                   (_opt_or d.shrink Shrink.nil))
  ...

vch9 avatar Dec 03 '21 11:12 vch9

You know, that makes a lot of sense. Good idea :+1:

c-cube avatar Dec 03 '21 14:12 c-cube