[Haskell-cafe] quickCheck problem

Rogan Creswick creswick at gmail.com
Wed Oct 7 18:25:16 UTC 2015


On Wed, Oct 7, 2015 at 10:01 AM, Roelof Wobben <r.wobben at home.nl> wrote:
> Op 7-10-2015 om 18:32 schreef Rogan Creswick:
>>
>> On Wed, Oct 7, 2015 at 12:13 AM, Roelof Wobben <r.wobben at home.nl> wrote:
>>>
>>> I know that if three numbers are the same then the outcome will be false.
>>> The same if two numbers are the same.
>>>
>>> Can I not do something like this :
>>>
>>> prop_different x y z = not( (x /= y && y /= z && x /= z))
>>>
>>> to test all cases at once.
>>
>> That looks like it will work (I'm assuming you're actually calling
>> your function in the property and comparing with that boolean
>> expression); is that the same way your function is implemented?
>>
>> --Rogan
>>
>
> Unfortanally yes but I do not know another way to test it.
> Im only a beginner which has read 2 chapters of the Crafts book.

Then I'd suggest using the quickcheck property guards ( `==>`) to only
generate inputs that are known to be equal, or not equal and test
separately in a few different properties.

--Rogan

>
>
> Roelof
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe


More information about the Haskell-Cafe mailing list