Running properties that do not draw any random values only once

Koen Claessen koen at chalmers.se
Wed Apr 11 23:48:34 BST 2012


Hi,

I have had this request before, but decided then that it was not
really worth spending much time on, because if there are no arguments,
the result of the property will only be evaluated once anyway, because
of laziness.

Yes, that value will be compared with True 100 times, but surely that
is no big deal?

Or are you suffering from performance problems here?

(If so, we could perhaps add a flag to the Result type that indicates
if retesting is necessary. Any quantification operator will set this
flag.)

/Koen

On Wed, Apr 11, 2012 at 5:50 PM, Simon Hengel <sol at typeful.net> wrote:
> Hi,
> I think it would be interesting, if we could detect situation when it
> makes no sense to run a property repeatedly, say:
>
>    some_property = True
>
>
> Why is this interesting?
>
> (1) It would allow me to use QuickCheck to verify simple properties in
>    documentation (this is a frequently requested feature for doctest).
>
>    Here is an example from [1].
>
>        pathSeparator == '\\'
>
>
> (2) It would make QuickCheck suitable for cases that are currently more
>    efficiently tested with HUnit; with the added benefit that changing
>    the arity would turn such a property into a real QC property.
>
>    Say start with:
>
>        prop_foo = length xs >= 0
>          where xs = "bar"
>
>    And later turn it into:
>
>        prop_foo xs = length xs >= 0
>          where types = xs :: String
>
>
> (3) Or you could start with a QuickCheck property, and later turn it into
>    a smallcheck-like thing.
>
>    Say start with:
>
>        prop_foo x = p x
>
>    And later turn it into:
>
>        prop_foo = all p xs
>          where xs = [minBound .. maxBound]
>
>
> I haven't looked at any code yet, and haven't thought about it
> thoroughly.  So for now I'm mainly interested if somebody has already
> pushed into that direction.
>
> Could it work to just check whether a property has drawn anything from
> the random pool?
>
> Cheers,
> Simon
>
> [1] http://hackage.haskell.org/packages/archive/filepath/1.3.0.0/doc/html/System-FilePath-Posix.html
>
> _______________________________________________
> QuickCheck mailing list
> QuickCheck at projects.haskell.org
> http://projects.haskell.org/cgi-bin/mailman/listinfo/quickcheck



More information about the QuickCheck mailing list