hedgehog-quickcheck: Use QuickCheck generators in Hedgehog and vice versa.

[ bsd3, library, testing ] [ Propose Tags ]

Use QuickCheck generators in Hedgehog and vice versa.

Hedgehog is a modern property-based testing system, in the spirit of QuickCheck. Hedgehog uses integrated shrinking, so shrinks obey the invariants of generated values by construction.

To get started quickly, see the examples: <https://github.com/hedgehogqa/haskell-hedgehog/tree/master/hedgehog-


[Skip to Readme]
Versions [RSS] [faq] 0.1, 0.1.1
Change log CHANGELOG.md
Dependencies base (>=3 && <5), hedgehog (>=0.5 && <1.1), QuickCheck (>=2.7 && <2.15), transformers (>=0.4 && <0.6) [details]
License BSD-3-Clause
Author Jacob Stanley
Maintainer Jacob Stanley <jacob@stanley.io>
Revised Revision 1 made by moodmosaic at 2020-12-08T20:09:10Z
Category Testing
Home page https://hedgehog.qa
Bug tracker https://github.com/hedgehogqa/haskell-hedgehog/issues
Source repo head: git clone git://github.com/hedgehogqa/haskell-hedgehog.git
Uploaded by JacobStanley at 2019-05-18T03:42:40Z
Distributions LTSHaskell:0.1.1, NixOS:0.1.1, Stackage:0.1.1
Downloads 8154 total (459 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2019-05-18 [all 1 reports]

Modules

[Index] [Quick Jump]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

For package maintainers and hackage trustees

Candidates


Readme for hedgehog-quickcheck-0.1.1

[back to package description]

hedgehog-quickcheck Hackage

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.