QuickCheckVariant

Generator of "valid" and "invalid" data in a type class https://github.com/sanjorgek/QuickCheckVariant

Latest on Hackage:0.2.0.0

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

GPL-3 licensed by Jorge Santiago Alvarez Cuadros

QuickCheckVariant

Generator of "valid" and "invalid" data in a type class

For example, if you created

data Person = Anonymous { getId::String } | Client { getUsername::String, getName::String, getEmail::String} deriving(Show,Eq)

We can provide means to generate valid and invalid data, like:

```haskell instance Variant Person where valid = do id <- alternative username <- alternative name <- alternative domain <- alternative ext <- alternative (oneof . return) [Anonymous id, Client username name (username++"@"++domain++ext)] invalid = do username <- alternative name <- alternative return $ Client username name ""

```

See this post for more details

Depends on:
Used by 1 package:
comments powered byDisqus