[Haskell-cafe] Re: Quickcheck examples and Data.Word32

Shae Matijs Erisson shae at ScannedInAvian.com
Thu Oct 27 10:47:00 EDT 2005


Joel Reymont <joelr1 at gmail.com> writes:

> Does anyone have QuickCheck examples they could send me?

There's a minimal introduction to QuickCheck and HUnit in the most recent issue
of The Monad.Reader: http://www.haskell.org/tmrwiki/IssueFive

> Also, how can I check Word32, Word64, etc. properties? It looks like
> the built-in random generator only works with Int values and for the
> life of me I cannot figure out how to extend it.

You can build your own data generators easily.
I was planning to cover that in the next TMR issue.

In the meantime, these examples may help:

http://www.scannedinavian.org/~shae/src/haskell/TestCore.hs
http://www.scannedinavian.org/~shae/src/haskell/Tests.hs
http://www.scannedinavian.org/~shae/combinatorrent/Bittorrent/BEncode.hs


> Last but not least, I'm trying to figure out how I can use QuickCheck
> with tests against a network server. I would want to make sure that a
> certain packet sequence always produces a particular packet sequence
> in response. Is this a good area to apply QC?

You can do that with the model based checking from the QuickCheckST paper.
You could either generate actions and results and test separately, or you can
use unsafePerformIO to run IO tests from inside QuickCheckM.

I would very much like to see QuickCheckM extended to handle IO directly.
I've wanted to use QuickCheck to test TCP/IP stacks for unhandled cases.
Think of the entertainment value :-)

I hope that QuickCheck2 or a preview version is released soon.
I'd like to do more with QC.
-- 
Shae Matijs Erisson - http://www.ScannedInAvian.com/ - Sockmonster once said:
You could switch out the unicycles for badgers, and the game would be the same.



More information about the Haskell-Cafe mailing list