testing-feat

Functional Enumeration of Algebraic Types

https://github.com/JonasDuregard/testing-feat

Version on this page:1.1.0.0
LTS Haskell 22.41:1.1.1.1
Stackage Nightly 2024-11-12:1.1.1.1
Latest on Hackage:1.1.1.1

See all snapshots testing-feat appears in

BSD-3-Clause licensed by Jonas Duregård
Maintained by [email protected]
This version can be pinned in stack with:testing-feat-1.1.0.0@sha256:7c7629c5014edf06aefbf30a061d1ee64c6ee15f438d868e34749fb22208ab0b,2466

Feat (Functional Enumeration of Algebraic Types) provides enumerations as functions from natural numbers to values (similar to toEnum but for any algebraic data type). This can be used for SmallCheck-style systematic testing, QuickCheck style random testing, and hybrids of the two.

The enumerators are defined in a very boilerplate manner and there is a Template Haskell script for deriving the class instance for most types. Test.Feat contain a subset of the other modules that should be sufficient for most test usage. There are some small and large example in the tar ball.

The generators are provided by the size-based package. This means other libraries that implement the Sized class can use the same generator definitions. One such is the lazy-search package, that uses laziness to search for values and test properties. This is typically a lot faster than Feat for properties that have preconditions (logical implication), but can not be used for random selection of values.