hspecVariant: Spec for testing properties

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

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


[Skip to Readme]

Modules

[Index] [Quick Jump]

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 (>=1.0.1.0 && <2) [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 2021-10-23T00:14:39Z
Distributions
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 2279 total (14 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2021-10-23 [all 1 reports]

Readme for hspecVariant-1.0.1.0

[back to package description]

hspecVariant

Spec for testing properties for variant types

hspecVariant pipeline status

{-# 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.QuickCheck
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