About

Metadata

  • Last updated , by sanjorgek
  • License GPL-3.0-only
  • Categories Testing
  • Maintained by: sanjorgek@ciencias.unam.mx

  • Lottery factor: 0

Links

Installation

Readme

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