hspecVariant: Spec for testing properties for variant types

[ gpl, library, testing ] [ Propose Tags ]

Spec for testing properties for variant types. Uses QuickCheckVariant package.


[Skip to Readme]
Versions 0.1.0.0, 0.1.0.1, 1.0.0.0
Dependencies base (>=4.6 && <5), hspec (>=2.2 && <3), QuickCheckVariant (==1.*) [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 Fri Feb 2 01:26:54 UTC 2018
Distributions NixOS:1.0.0.0
Downloads 570 total (17 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-02-02 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's 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