[Haskell-cafe] QuickCheck-like tests with GHC.Generic, deriving
Janis Voigtlaender
jv at informatik.uni-bonn.de
Wed Nov 20 12:06:50 UTC 2013
Alexander Solla writes:
> I am looking for a QuickCheck-like test framework which exposes data
> generators (like QuickCheck's Arbitrary class) with Generic defaults.
>
> I have seen that SmallCheck's Serial class has Generic defaults, but it
> isn't particularly good for my purpose (I'd like to use the generator to
> populate deeply nested data types, and SmallCheck's generator requires
> computing a few million values before I get any interesting ones)
> Something "random" would be more useful for my purpose.
>
> I know that the plan depends on my vaguely abusing the test-case generator,
> but I plan on doing some testing anyway, so I figured I should reuse the
> instance.
>
> That said, I'd be willing to use any random value type class with
> Generic-default instances.
>
> Does anybody have any suggestions?
I think what you want is:
http://hackage.haskell.org/package/testing-feat
See also the paper:
http://dx.doi.org/10.1145/2430532.2364515
Specifically, the technique solves the "populate deeply nested data
types" issue. You can efficiently jump to the so-and-so-many-millionth
value in the enumeration without having to create all smaller values.
Best,
Janis.
More information about the Haskell-Cafe
mailing list