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] [Publish]

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


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.1.0.1, 1.0.0.0, 1.0.0.0, 1.0.1.0
Change log None available
Dependencies base (>=4.6 && <5), hspec (>=2.2 && <3), QuickCheckVariant (>=1 && <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 2018-02-02T01:25:49Z

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

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