quickcheck-assertions

HUnit like assertions for QuickCheck https://github.com/s9gf4ult/quickcheck-assertions

Version on this page:0.2.0
LTS Haskell 9.14:0.3.0
Stackage Nightly 2017-11-19:0.3.0
Latest on Hackage:0.3.0
LGPL-3 licensed by Aleksey Uymanov
Maintained by s9gf4ult@gmail.com

Module documentation for 0.2.0

There are no documented modules for this package.

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

Changes

0.3.0

  • Changelog added
  • Use pretty-show for error descriptions (usefull with huge test cases)
Used by 1 package:
comments powered byDisqus