hspecVariant: Spec for testing properties for variant types

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. Uses QuickCheckVariant package.


[Skip to ReadMe]

Properties

Versions0.1.0.0, 0.1.0.1, 1.0.0.0, 1.0.0.0
Change logNone available
Dependenciesbase (>=4.6 && <5), hspec (>=2.2 && <3), QuickCheckVariant (==1.*) [details]
LicenseGPL-3.0-only
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
UploadedFri Feb 2 01:25:49 UTC 2018 by sanjorgek

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees


Readme for hspecVariant-1.0.0.0

[back to package description]

hspecVariant

Spec for testing properties for variant types

hspecVariant

{-# LANGUAGE TypeSynonymInstances #-}
import Test.QuickCheck.Variant

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)

Test

import Test.Hspec
import Test.Hspec.Variant

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

More badges

QuickCheckVariant

forthebadge

forthebadge

forthebadge

forthebadge