Hi all,

John Hughes and I have been working on a Haskell
module called "QuickCheck", which allows one to
express properties about Haskell functions in
a program.

The module also provides functions that can
generate random test cases for these properties,
and perform the testing.

Here is an example. We define:

  prop_AddIntAssociative x y z =
    x + (y + z) == (x + y) + (z :: Int)

And then run in Hugs:

  Hugs> quickCheck prop_AddIntAssociative
  OK, passed 100 test cases

If we define the following however:

  prop_AddDoubleAssociative x y z =
    x + (y + z) == (x + y) + (z :: Double)

We get:

  Hugs> quickCheck prop_AddDoubleAssociative
  Falsifiable, after 10 tests:
  -2.6
  13.1
  -8.4

The tool has been very useful in a number of projects,
among which in the development of circuits in Lava,
and in discovering bugs in programs.

We have submitted a DRAFT paper to ESOP, and we provide
a DRAFT implementation, downloadable from:

  http://www.cs.chalmers.se/~koen/publications.html

John Hughes has given a talk about it, here are the slides:

  http://www.cs.chalmers.se/~rjmh/QuickCheck/index.htm

Note that, because of the tool still being in development,
there are slight differences in function names between
these presentations.

Comments are very welcome!

The implementation is Haskell'98 compatible.

Regards,
Koen.

--
Koen Claessen         http://www.cs.chalmers.se/~koen     
phone:+46-31-772 5424      e-mail:[EMAIL PROTECTED]
-----------------------------------------------------
Chalmers University of Technology, Gothenburg, Sweden

Reply via email to