[QuickCheck] Unxpected compositional behaviour

Nick Smallbone nick.smallbone at gmail.com
Thu Jan 30 13:33:31 GMT 2014


Hi Erik,

The reason this happens is that Property is currently a type synonym
for Gen Prop - i.e. something which when given a random number seed
will return a test outcome. In your example you are testing the first
property and then throwing away the result. Property should really be
an abstract type to prevent this kind of problem - I've put it on my
todo list :)

Nick

On Wednesday 29 January, 2014 at 05:28 pm, Erik de Castro Lopo wrote:
> Hi all,
> 
> This issue came up with respect to Hspec which uses QuickCheck as a
> library:
> 
>      https://github.com/hspec/hspec/issues/149
> 
> but it seems to really be a QuickCheck issue which can be easily
> demonstrated like this:
> 
>     ghci> import Test.QuickCheck
>     ghci> let prop_foo = 1 == 2
>     ghci> let prop_bar = 1 == 1
>     ghci> quickCheck (property prop_foo >> property prop_bar)
>     +++ OK, passed 100 tests.
> 
> The first of those properties should fail, but doesn't. I think, that
> without knowing the current behaviour, most people asked to guess what
> the behaviour *should* be would say that the first property should 
> cause the failure of the whole test.
> 
> Do other people have the same view? Can this be easily fixed?
> 
> Cheers,
> Erik
> -- 
> ----------------------------------------------------------------------
> Erik de Castro Lopo
> http://www.mega-nerd.com/
> 
> _______________________________________________
> QuickCheck mailing list
> QuickCheck at projects.haskell.org
> http://projects.haskell.org/cgi-bin/mailman/listinfo/quickcheck



More information about the QuickCheck mailing list