hspecVariant: Spec for testing properties for variant types

[ gpl, library, testing ] [ Propose Tags ] [ Report a vulnerability ]

Spec for testing properties for variant types


[Skip to Readme]

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.1.0.0, 0.1.0.1, 1.0.0.0, 1.0.1.0
Dependencies base (>=4.6 && <5), hspec (>=2.2 && <3), QuickCheckVariant (==0.1.1.0) [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/hspecVariant
Bug tracker https://github.com/sanjorgek/hspecVariant/issues
Source repo head: git clone git@github.com:sanjorgek/hspecVariant.git
Uploaded by sanjorgek at 2016-07-28T01:06:58Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 2278 total (16 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2016-07-28 [all 1 reports]

Readme for hspecVariant-0.1.0.0

[back to package description]

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