Permalink
Browse files

Use QuickCheck generators in Hedgehog

  • Loading branch information...
moodmosaic committed Sep 23, 2018
1 parent 528be10 commit d9699b5a1da551297fa5fada230dd44ebe3cd49d
Showing with 5 additions and 3 deletions.
  1. +1 −0 Problem23.cabal
  2. +4 −3 test/Spec.hs
View
@@ -35,6 +35,7 @@ test-suite Problem23-test
build-depends: base
, Problem23
, hedgehog >= 0.6.1
, hedgehog-quickcheck
, random
ghc-options: -threaded -rtsopts -with-rtsopts=-N
default-language: Haskell2010
View
@@ -7,6 +7,7 @@ import Control.Monad (unless)
import Data.List (genericLength)
import Hedgehog
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Gen.QuickCheck as Gen
import qualified Hedgehog.Range as Range
import Lib
import System.Exit (exitFailure)
@@ -38,11 +39,11 @@ properties :: IO Bool
properties =
checkParallel $ Group "Properties" [
("rndGenSelect returns result of correct length"
, lenProp (Gen.int $ Range.linear (-100) 100))
, lenProp (Gen.arbitrary :: Gen Int))
, ("rndGenSelect returns result of correct length"
, lenProp Gen.alpha)
, lenProp (Gen.arbitrary :: Gen Char))
, ("rndGenSelect returns empty result when count is negative"
, negLenProp (Gen.int $ Range.linear (-100) 100))
, negLenProp (Gen.arbitrary :: Gen Int))
]
regressionTests :: IO Bool

0 comments on commit d9699b5

Please sign in to comment.