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

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Warnings:

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


[Skip to Readme]

Properties

Versions 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.0.4, 0.1.1.0, 0.2.0.0, 1.0.0.0, 1.0.0.1, 1.0.0.1, 1.0.1.0
Change log None available
Dependencies base (>4.6 && <5), QuickCheck (>2.10 && <2.12) [details]
License GPL-3.0-only
Copyright (c) Jorge Santiago Alvarez Cuadros
Author Jorge Santiago Alvarez Cuadros
Maintainer sanjorgek@ciencias.unam.mx
Category Testing
Home page https://github.com/sanjorgek/QuickCheckVariant
Bug tracker https://github.com/sanjorgek/QuickCheckVariant/issues
Source repo head: git clone git@github.com:sanjorgek/QuickCheckVariant.git
Uploaded by sanjorgek at 2018-06-27T14:35:51Z

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for QuickCheckVariant-1.0.0.1

[back to package description]

QuickCheckVariant

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

QuickCheckVariant

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:

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

More badges

QuickCheckVariant

forthebadge

forthebadge

forthebadge

forthebadge