qcheck icon indicating copy to clipboard operation
qcheck copied to clipboard

Deriver: qcheck and qcheck2

Open vch9 opened this issue 4 years ago • 1 comments

Closes #190

This PR introduces two derivation plugins:

  • qcheck
  • qcheck2

The code and test is duplicated, in the vast majority it's only a renaming to QCheck to QCheck2 (excepts for fun_nary)

- utop # type t = int
val gen : t QCheck.Gen.t = <fun>
val arb : t QCheck.arbitrary =
  {QCheck.gen = <fun>; print = None; small = None; shrink = None;
   collect = None; stats = []}
─( 15:46:16 )─< command 2 >─────
- utop # type t = int [@@deriving qcheck2];;
type t = int
val gen : t QCheck2.Gen.t = <abstr>

This it not ideal as we only derive generators then call make on them, the best would be to use arbitrary for primitive types as they also have printers, shrinkers etc.

However after #195, #208 and this one, I'm getting tired of writing boilerplate code, but I will eventually do this in the future :)

vch9 avatar Dec 13 '21 17:12 vch9

Used @tmcgilchrist suggestion to reduce the code duplication and rebased to master. The commits should be squashed on merge, I'm not sure each of them compile and it's not that important if they're split.

vch9 avatar Jan 24 '22 17:01 vch9