QCheck2.Gen: enforce naming consistency for type int
First PR of attempting to tackle https://github.com/c-cube/qcheck/pull/223 in multiple smaller mrs. It should facilitate reviews.
Notice that I move code around so int t generators are close to each other both in the implementation and interface.
Naturals
Generators becomes:
val nat : int t
val nat_small : int t
val nat_big : int t
val nat_corners : unit -> int t
Deprecated natural generators are:
val small_nat : int t
(** @deprecated use {!nat_small} *)
val big_nat : int t
(** @deprecated use {!nat_big} *)
Classic generators
Generators becomes:
val int : int t
val int_neg : int t
val int_pos : ?origin : int -> int t
val int_small : int t
val int_big : int t
val int_corners : unit -> int t
val int_pos_bound : int -> int t
val int_range : ?origin:int -> int -> int -> int t
val (--) : int -> int -> int t
Deprecated generators are:
val neg_int : int t
(** @deprecated use {!int_neg} *)
val small_signed_int : int t
(** @deprecated use {!int_small} *)
val small_int_corners : unit -> int t
(** @deprecated use {!nat_corners} *)
val pint : ?origin : int -> int t
(** @deprecated use {!int_pos} *)
val int_bound : int -> int t
(** @deprecated use {!int_pos_bound} *)
I then ran
git grep <generator> src/core/QCheck2.* test/core/QCheck2*
On each deprecated generator to see if all occurrences (expected the deprecation cycle) were removed.
TODO
- [ ]
int_poshas?originbutint_negdoes not, makes it weird. - [ ] CHANGELOG
- [ ] Potentially add regression tests for every uncovered tests
Question
Now that we have this smaller PR, we can question the existence of nat and/or int_pos
@jmid you said in the last PR
I noticed that
- nat is non-uniform and at most 10.000 - while int is uniform over all OCaml ints. (one should use nat_origin 0 to get a behavior mirroring int)
- there's no int_big
I think we could change nat* to become kind of an alias to int_pos*. That'd mean that int_pos would be removed and underlying generators for naturals will become uniform over OCaml positive integers rather than "non-uniform and at most 10.000"