This PR fixes #252 to prepare for the forthcoming OCaml5 release.
Since OCaml5 comes with a new, splittable LXM PRNG (https://github.com/ocaml/ocaml/pull/10742), the output distribution from Random.State.* changes - and so affects our QCheck expect tests. This PR adds .ocaml5 output-files similar to the current .32 and .64 files for OCaml<5.0 on 32-bit and 64-bit, respectively. The meta-programming in dune-files is then extended to account for the .ocaml5-case. OCaml5 will not support 32-bit in the foreseeable future (if ever) which eliminates a case.
There are two nits with the approach:
Extracting a leading digit from Sys.ocaml_version requires a bit of leg-work to work on earlier OCaml versions (Sys.ocaml_release was only recently added)
QCheck2 unit tests of char depend on the PRNG - which then need to account for the two cases. This is an unfortunate consequence of how the QCheck2 code is structured, not allowing us to test char shrinking independently.
This PR fixes #252 to prepare for the forthcoming OCaml5 release.
Since OCaml5 comes with a new, splittable LXM PRNG (https://github.com/ocaml/ocaml/pull/10742), the output distribution from
Random.State.*
changes - and so affects our QCheck expect tests. This PR adds.ocaml5
output-files similar to the current.32
and.64
files for OCaml<5.0 on 32-bit and 64-bit, respectively. The meta-programming indune
-files is then extended to account for the.ocaml5
-case. OCaml5 will not support 32-bit in the foreseeable future (if ever) which eliminates a case.There are two nits with the approach:
Sys.ocaml_version
requires a bit of leg-work to work on earlier OCaml versions (Sys.ocaml_release
was only recently added)char
depend on the PRNG - which then need to account for the two cases. This is an unfortunate consequence of how the QCheck2 code is structured, not allowing us to testchar
shrinking independently.Another solution to the above would be to use https://github.com/ocaml/randomV - a backward port of OCaml5's LXM PRNG.
Overall I therefore believe this PR is a reasonable first step to get expect tests running on OCaml5.
I've tested the PR code locally on
While doing the latter I spotted the missing 32-bit update fixed in #261