vincent-hugot / qtest

Inline (Unit) Tests for OCaml
GNU General Public License v3.0
67 stars 8 forks source link

Requirement on QCheck.int_range missing #44

Closed jmid closed 7 years ago

jmid commented 7 years ago

The following makes QCheck.int_range fail with Exception: Invalid_argument "Random.int".

open QCheck
(int_range 0 (0x3FFFFFFF)).gen (Random.get_state ());;

The problem seems to be that the length of the interval is passed to Random.int which fails for any argument above 0x3FFFFFFF, thereby placing an implicit requirement on the acceptable interval lengths of int_range.

c-cube commented 7 years ago

Can I close?

jmid commented 7 years ago

I've had a look at the operations in random.ml that we are calling. It should be possible without too much effort to lift this limitation. I'll give it a shot now (hoping my missing git foo doesn't get in the way..)

c-cube commented 7 years ago

The difficult part is uniformity, good luck!

jmid commented 7 years ago

Ok, I just pushed (to QCheck) an attempt at lifting this restriction. Sorry, I initially confused this issue with the similar issue on QCheck. You are welcome to close this one as it is tracked elsewhere.