The hedgehog-quickcheck package

[ Tags: bsd3, library, testing ] [ Propose Tags ]

Use QuickCheck generators in Hedgehog and vice versa.


[Skip to Readme]

Properties

Versions 0.1
Change log CHANGELOG.md
Dependencies base (>=3 && <5), hedgehog (==0.5.*), QuickCheck (>=2.7 && <2.11), transformers (>=0.4 && <0.6) [details]
License BSD3
Author Jacob Stanley
Maintainer Jacob Stanley <jacob@stanley.io>
Category Testing
Home page https://hedgehog.qa
Bug tracker https://github.com/hedgehogqa/haskell-hedgehog/issues
Source repository head: git clone git://github.com/hedgehogqa/haskell-hedgehog.git
Uploaded Sun Jul 16 11:50:20 UTC 2017 by JacobStanley
Distributions LTSHaskell:0.1, NixOS:0.1, Stackage:0.1
Downloads 108 total (19 in the last 30 days)
Rating 0.0 (0 ratings) [clear rating]
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-07-16 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for hedgehog-quickcheck-0.1

[back to package description]

hedgehog-quickcheck Hackage

Hedgehog will eat all your bugs.

<img src="https://github.com/hedgehogqa/haskell-hedgehog/raw/master/img/hedgehog-logo.png" width="307" align="right"/>

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.