quickcheck-assertions: HUnit like assertions for QuickCheck

[ lgpl, library, testing ] [ Propose Tags ] [ Report a vulnerability ]

Library with convenient assertions for QuickCheck properties like in HUnit


[Skip to Readme]

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0, 0.1.1, 0.2.0, 0.3.0
Change log CHANGELOG.md
Dependencies base (>=4 && <5), ieee754, pretty-show, QuickCheck (>=2.3) [details]
License LGPL-3.0-only
Author Aleksey Uymanov
Maintainer s9gf4ult@gmail.com
Category Testing
Home page https://github.com/s9gf4ult/quickcheck-assertions
Source repo head: git clone git://github.com/s9gf4ult/quickcheck-assertions.git
Uploaded by AlekseyUymanov at 2017-01-17T11:53:56Z
Distributions Arch:0.3.0, LTSHaskell:0.3.0, NixOS:0.3.0, Stackage:0.3.0
Reverse Dependencies 2 direct, 0 indirect [details]
Downloads 6339 total (28 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-01-17 [all 1 reports]

Readme for quickcheck-assertions-0.3.0

[back to package description]

Module provides convenient functions to do some assertions in QuickCheck properties with pretty printed reasons. For example you can do something like that:

module Main where

import Test.Hspec
import Test.Hspec.QuickCheck
import Test.QuickCheck.Assertions
import Test.QuickCheck.Property

someProp :: Int -> Int -> Result
someProp a b = (a ?> b)

someOtherProp :: Double -> Double -> Result
someOtherProp a b = (a ?== b)
               
main = hspec $ describe "failing test" $ do
  prop "must fail" $ someProp
  prop "must fail again" $ someOtherProp

And receive pretty printed fail message when testing:

failing test
  - must fail FAILED [1]                    
  - must fail again FAILED [2]                             

1) failing test must fail FAILED
*** Failed! (after 1 test): 
>>>>>>>>>>>>>> the value
0
>>>>>>>>>>>>>> should be greater than value
0
0
0


2) failing test must fail again FAILED
*** Failed! (after 2 tests and 4 shrinks): 
>>>>>>>>>>>>>> expected
0.0
>>>>>>>>>>>>>> but got
1.0
0.0
1.0