The hspecVariant package

[Tags:gpl, library]

Spec for testing properties for variant types


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.0.1
Dependencies base (>=4.6 && <5), hspec (>=2.2 && <3), QuickCheckVariant (==0.2.0.0) [details]
License GPL-3
Copyright (c) Jorge Santiago Alvarez Cuadros
Author Jorge Santiago Alvarez Cuadros
Maintainer sanjorgek@ciencias.unam.mx
Stability Unknown
Category Testing
Home page https://github.com/sanjorgek/hspecVariant
Bug tracker https://github.com/sanjorgek/hspecVariant/issues
Source repository head: git clone git@github.com:sanjorgek/hspecVariant.git
Uploaded Mon Jan 23 17:24:47 UTC 2017 by sanjorgek
Distributions NixOS:0.1.0.1
Downloads 65 total (7 in the last 30 days)
Votes
0 []
Status Docs available [build log]
Last success reported on 2017-01-23 [all 1 reports]

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees

Readme for hspecVariant

Readme for hspecVariant-0.1.0.1

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)

Test

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