[QuickCheck] Unxpected compositional behaviour

Nick Smallbone nick.smallbone at gmail.com
Thu Jan 30 15:51:43 GMT 2014


Update: Property is now a newtype, so the below code now fails to
typecheck (as it should).

Nick

P.S. If you really want to test several properties at once, you may
find the 'conjoin' combinator useful.

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