QuickCheck-like tests with GHC.Generic deriving

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?

Hi 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.
Maybe you can make your data instances of Random http://hackage.haskell.org/package/random-1.0.0.2/docs/System-Random.html#t:... and https://www.fpcomplete.com/school/starting-with-haskell/libraries-and-framew... --Lucas
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?
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Hello,
regular http://hackage.haskell.org/package/regular-0.3.4 has a generic
implementation of Arbitrary that even lets you specify size and
give each constructor a particular frequency (see
Generics.Regular.Functions.Arbitrary).http://hackage.haskell.org/package/regular-extras-0.2.2/docs/Generics-Regula...
If you find it useful, I'm sure it can be ported to the
generic-derivinghttp://hackage.haskell.org/package/generic-derivingpackage,
so that it
works with GHC.Generics (or maybe to some generic-deriving-extras package
to avoid
making generic-deriving depend on QuickCheck).
Cheers,
Pedro
On Wed, Nov 20, 2013 at 6:57 AM, Alexander Solla
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?
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

There’s a branch adding support for Generic deriving of Arbitrary, more
than a year old. I always wondered why it was never merged into master and
released on Hackage.
On Wed, Nov 20, 2013 at 9:02 AM, José Pedro Magalhães
Hello,
regular http://hackage.haskell.org/package/regular-0.3.4 has a generic implementation of Arbitrary that even lets you specify size and give each constructor a particular frequency (see Generics.Regular.Functions.Arbitrary).http://hackage.haskell.org/package/regular-extras-0.2.2/docs/Generics-Regula... If you find it useful, I'm sure it can be ported to the generic-derivinghttp://hackage.haskell.org/package/generic-derivingpackage, so that it works with GHC.Generics (or maybe to some generic-deriving-extras package to avoid making generic-deriving depend on QuickCheck).
Cheers, Pedro
On Wed, Nov 20, 2013 at 6:57 AM, Alexander Solla
wrote: 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?
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (4)
-
Alexander Solla
-
Dag Odenhall
-
José Pedro Magalhães
-
lucas di cioccio