The hspecVariant package

[maintain]

Spec for testing properties for variant types


[Skip to ReadMe]

Properties

Versions0.1.0.0, 0.1.0.0, 0.1.0.1
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