[prev in list] [next in list] [prev in thread] [next in thread] 

List:       haskell-cafe
Subject:    Re: [Haskell-cafe] QuickCheck - Extracting data values from tests
From:       Shae Matijs Erisson <shae () ScannedInAvian ! com>
Date:       2004-09-02 14:09:57
Message-ID: 87y8jsvk22.fsf () thunderbird ! scannedinavian ! com
[Download RAW message or body]

Jorge Adriano Aires <jadrian@mat.uc.pt> writes:

> Hello all,
> When using Quickcheck, is there some way to extract generated data values to 
> the IO Monad? 
>
> I know I can collect and print information about test cases, but that's not 
> enough. Data may be pretty complex, and there may be no parsers for it. If a 
> test suddenly goes wrong, just having it displayed doesn't seem that useful.

You may be interested in a QuickCheck hack of mine that saves the offending
data value to use immediately in the next test run.

You can get the current version with 
"darcs get http://thunderbird.scannedinavian.com/repos/quickcheck"
I've only used this for my own code, so I'd be interested in any feedback.

In some cases it's a lot easier to generate a value from a seed and size rather
than saving the value in some way that you can restore (ie functions).

I've been investigating doing test-driven-development with QuickCheck, saving
failing test cases is one step towards that goal. If you have more ideas on
that topic, I'd like to hear about it.

> Also, even when I'm implementing a generator, I want to see how it is
> working. Running a verboseCheck on some dummy property helps, but I may want
> to analyse the data, or some parts of it better - for instance, for many data
> structures I have alternative "show" functions that take parameters as
> arguments.

This isn't clear to me, can you give other examples?
-- 
Shae Matijs Erisson - Programmer - http://www.ScannedInAvian.org/
"I will, as we say in rock 'n' roll, run until the wheels come off, 
because I love what I do." -- David Crosby


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic