krestenkrab / triq

Trifork QuickCheck
http://krestenkrab.github.com/triq/
Apache License 2.0
281 stars 54 forks source link

Fix int/2 generator #41

Closed essen closed 9 years ago

essen commented 9 years ago

The issue was that the maximum value picked for the generator was the highest between SampleSize (which is potentially very big) and Diff (which is the real maximum we don't want to cross). Instead we now pick the lowest, ensuring that we won't generate a value bigger than Diff.

Tests suggested by @krestenkrab.

The test output now looks a little weird though ahah:

Testing triq_tests:prop_intrange/0
....................................................................................................
Ran 100 tests
.....................................................................................................
Ran 100 tests
.....................................................................................................
Ran 100 tests
.....................................................................................................
Ran 100 tests
.....................................................................................................
Ran 100 tests
.....................................................................................................
Ran 100 tests
.....................................................................................................
...

But I suppose this is harmless. :-)