Closed essen closed 9 years ago
This test fails with the current code base:
prop_intrange() ->
?FORALL({X,Y},
?SUCHTHAT({XX,YY},
{int(), int()},
XX < YY),
true = triq:counterexample( prop_intrange(X,Y))).
prop_intrange(X,Y) when X < Y ->
?FORALL(I, int(X,Y),
?WHENFAIL(io:format("Min=~p, Max=~p, I=~p~n", [X,Y,I]),
(I >= X) andalso (I =< Y))).
Basically, it just invokes trip recursively for each set of {X,Y}
values.
The failure looks like this:
Ran 100 tests
Testing triq_tests:prop_intrange/0
.Failed!
Min=0, Max=1, I=2
Failed after 2 tests with false
Simplified:
I = 2
Failed with: [2]
Failed after 1 tests with [2]
Simplified:
{ X , Y } = {0,0}
triq_tests: run_property_testing_test_...*failed*
Now try fixing that :-)
Wow that's much better yes. I will do that now.
See #41.
Thanks.
Hello,
The following property:
gives the following output:
As you can see the max limit is not enforced as one would expect. This makes generating integers between 1 and 12 difficult.
Changing "max" into "min" in the int/2 function seems to solve the problem:
If this seems correct I would like to submit a patch for this, but I am not sure how to write a test for it. Would using
triq_dom:sample
in a loop (run 100 times for example) be good enough? The only test seemingly similar I can see tests for boolean only.