Running properties that do not draw any random values only once

Simon Hengel sol at typeful.net
Wed Apr 11 16:50:20 BST 2012


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



More information about the QuickCheck mailing list