The hspecVariant package

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]

Spec for testing properties for variant types


[Skip to ReadMe]

Properties

Versions0.1.0.0, 0.1.0.0, 0.1.0.1
Change logNone available
Dependenciesbase (>=4.6 && <5), hspec (>=2.2 && <3), QuickCheckVariant (==0.1.1.0) [details]
LicenseGPL-3
Copyright(c) Jorge Santiago Alvarez Cuadros
AuthorJorge Santiago Alvarez Cuadros
Maintainersanjorgek@ciencias.unam.mx
CategoryTesting
Home pagehttps://github.com/sanjorgek/hspecVariant
Bug trackerhttps://github.com/sanjorgek/hspecVariant/issues
Source repositoryhead: git clone git@github.com:sanjorgek/hspecVariant.git
UploadedThu Jul 28 01:06:00 UTC 2016 by sanjorgek

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for hspecVariant-0.1.0.0

hspecVariant

Spec for testing properties for variant types

{-# LANGUAGE TypeSynonymInstances #-}

type Natural = Integer

instance Variant Natural where
  invalid = do
    n <- arbitrary
    if (n<0) then return n else return ((-1)*(n+1))
  valid = do
    n <- arbitrary
    if (n>=0) then return n else return ((-1)*(n+1))

Test

main::IO ()
main = hspec $
  describe "Naturals" $
    propValid "succ" $
      \x -> succ (x::Natural) > 0