[QuickCheck] Default value for "ok result" undefined
Nick Smallbone
nicsma at chalmers.se
Thu Apr 2 14:57:47 BST 2015
Hi,
Yes, 'result' is not really meant to be used directly, it's only used
in defining 'succeeded', 'failed' and 'rejected'. I've pushed a patch
which removes it to avoid confusion.
Having said that, you shouldn't need to directly manipulate results at
all just to write a property. In your case you can use the 'conjoin'
combinator which should do what you want, possibly together with
'counterexample' to label the individual test cases.
Nick
On Tuesday 31 March, 2015 at 08:27 pm, fro_ozen wrote:
> Hello QuickCheck mailinglist,
>
> this might no necessarily be a bug, but the default value of the "ok"
> record field of the Result
> returned by the "result" function in the Test.QuickCheck.Property module
> is undefined.
>
> This is not what one would expect from a Maybe type.
> The undefined can make for some nasty and hard to trace bugs in your
> tests if you, for example,
> use the Result in a fold (like I did here
> <https://github.com/froozen/kademlia/blob/master/test/Tree.hs#L57>) or
> try to check the value for some other reason.
>
> I would therefore propose to make the default value a "Nothing" or to
> warn about it in the documentation.
> _______________________________________________
> QuickCheck mailing list
> QuickCheck at projects.haskell.org
> http://projects.haskell.org/cgi-bin/mailman/listinfo/quickcheck
More information about the QuickCheck
mailing list