[Haskell-cafe] Re: QuickCheck and Pairing Heaps

Johannes Waldmann waldmann at imn.htwk-leipzig.de
Tue Aug 10 14:34:30 EDT 2010


> Hi, I'm trying to figure out QuickCheck 
> and how to generate arbitrary test data form complex data structures; 

sometimes the following workaround is enough:

if you have a function that makes a tree (heap)
from a list, then generate an "arbitrary" list,
and make the tree from that.

of course this might restrict your test set.

similarly, if you want to test a property 
that needs an ordered list (as input),
just generate an arbitrary list
and use a trusted sort function.

oh, and try Smallcheck as well.
http://www.cs.york.ac.uk/fp/smallcheck/
Similar idea, but using complete (instead of random)
enumeration. Sometimes that's easier to control. 

Regards, J.W.




More information about the Haskell-Cafe mailing list