Bogdanp / rackcheck

A property-based testing library for Racket.
28 stars 7 forks source link

gen:integer-in with lo = hi #1

Closed yiyunliu closed 3 years ago

yiyunliu commented 3 years ago

The contract checks if hi > lo. I believe that's a mistake. According to the documentation: "A contract error is raised if lo is greater than hi", the correct check should be hi >= lo.

This behavior of gen:integer-in also affects gen:frequency; when gen:frequency has a single pair in the list, I will get a contract error from gen:integer-in (which I assume gen:frequency somehow depends on?).

Bogdanp commented 3 years ago

Thanks for the report! The contract was indeed wrong, as the range should be inclusive between the two arguments.