test-framework-leancheck: LeanCheck support for test-framework.

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

LeanCheck support for test-framework.

This package can be used to incorporate LeanCheck tests into test-framework test suites.

Please see the Haddock documentation and README for more details.


[Skip to Readme]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.0.1, 0.0.2, 0.0.4
Dependencies base (>=4 && <5), leancheck, test-framework [details]
Tested with ghc ==9.0, ghc ==8.10, ghc ==8.8, ghc ==8.6, ghc ==8.4, ghc ==8.2, ghc ==8.0, ghc ==7.10
License BSD-3-Clause
Author Rudy Matela <rudy@matela.com.br>
Maintainer Rudy Matela <rudy@matela.com.br>
Category Testing
Home page https://github.com/rudymatela/test-framework-leancheck#readme
Source repo head: git clone https://github.com/rudymatela/test-framework-leancheck
this: git clone https://github.com/rudymatela/test-framework-leancheck(tag v0.0.4)
Uploaded by rudymatela at 2021-06-15T00:02:36Z
Distributions Arch:0.0.4, LTSHaskell:0.0.4, NixOS:0.0.4, Stackage:0.0.4
Reverse Dependencies 1 direct, 0 indirect [details]
Downloads 2769 total (38 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2021-06-15 [all 1 reports]

Readme for test-framework-leancheck-0.0.4

[back to package description]

test-framework-leancheck: LeanCheck support for test-framework

test-framework-leancheck's Build Status test-framework-leancheck on Hackage test-framework-leancheck on Stackage LTS test-framework-leancheck on Stackage Nightly

LeanCheck support for the test-framework test framework.

Installing

$ cabal install test-framework-leancheck

Example

Here's how your test.hs might look like:

import Test.Framework
import Test.Framework.Providers.LeanCheck as LC
import Data.List

main :: IO ()
main = defaultMain tests

tests :: [Test]
tests =
  [ LC.testProperty "sort . sort == sort"
      $ \xs -> sort (sort xs :: [Int]) == sort xs
  , LC.testProperty "sort == id" -- not really, should fail
      $ \xs -> sort (xs :: [Int]) == xs
  ]

And here is the output for the above program:

$ ./eg/test
sort . sort == sort: [OK, passed 100 tests.]
sort == id: [Failed]
*** Failed! Falsifiable (after 7 tests):
[1,0]

         Properties  Total
 Passed  1           1
 Failed  1           1
 Total   2           2

Options

Use -a or --maximum-generated-tests to configure the maximum number of tests for each property.

$ ./eg/test -a5
sort . sort == sort: [OK, passed 5 tests.]
sort == id: [OK, passed 5 tests.]

         Properties  Total      
 Passed  2           2          
 Failed  0           0          
 Total   2           2          

Since LeanCheck is enumerative, you may want to increase the default number of tests (100). Arbitrary rule of thumb:

  • between 200 to 500 on a developer machine;
  • between 1000 and 5000 on the CI.

Your mileage may vary.

Further reading