hedgehog-quickcheck

Use QuickCheck generators in Hedgehog and vice versa. https://hedgehog.qa

Version on this page:0.1
LTS Haskell 9.18:0.1
Stackage Nightly 2017-12-14:0.1
Latest on Hackage:0.1
BSD3 licensed by Jacob Stanley
Maintained by Jacob Stanley

Module documentation for 0.1

hedgehog-quickcheck ![Hackage][hackage-shield]

Hedgehog will eat all your bugs.

Use QuickCheck generators in Hedgehog and vice versa.

Example

The Hedgehog.Gen.QuickCheck module allows the use of QuickCheck generators inside Hedgehog.

{-# LANGUAGE TemplateHaskell #-}

import           Hedgehog
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Gen.QuickCheck as Gen
import qualified Hedgehog.Range as Range

Once you have your imports set up, you can write a property which mixes QuickCheck and Hedgehog generators together:

prop_reverse :: Property
prop_reverse =
  property $ do
    xs <- forAll $ Gen.list (Range.linear 0 100) (Gen.arbitrary :: Gen Char)
    reverse (reverse xs) === xs

And add the Template Haskell splice which will discover your properties:

tests :: IO Bool
tests =
  checkParallel $$(discover)

You can then load the module in GHCi, and run it:

λ tests
━━━ Test.Example ━━━
  ✓ prop_reverse passed 100 tests.

http://hackage.haskell.org/package/hedgehog-quickcheck [hackage-shield]: https://img.shields.io/hackage/v/hedgehog-quickcheck.svg

http://hackage.haskell.org/package/hedgehog-quickcheck/docs/Hedgehog-Gen-QuickCheck.html

Changes

Version 0.1 (2017-07-16)

https://github.com/jystic

https://github.com/hedgehogqa/haskell-hedgehog/pull/103

Depends on 4 packages:
comments powered byDisqus