tasty-leancheck: LeanCheck support for the Tasty test framework.

[ bsd3, library, testing ] [ Propose Tags ]

LeanCheck support for the Tasty test framework.

This package can be used to incorporate LeanCheck tests into Tasty test suites by means of the Test.Tasty.LeanCheck.testProperty function.

Please see the Haddock documentation and README for more details.


[Skip to Readme]

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.0.1, 0.0.2
Dependencies base (>=4 && <5), leancheck, tasty [details]
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/tasty-leancheck#readme
Source repo head: git clone https://github.com/rudymatela/tasty-leancheck
this: git clone https://github.com/rudymatela/tasty-leancheck(tag v0.0.1)
Uploaded by rudymatela at 2018-09-07T13:32:36Z
Distributions LTSHaskell:0.0.2, NixOS:0.0.2, Stackage:0.0.2
Reverse Dependencies 2 direct, 0 indirect [details]
Downloads 1229 total (13 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs uploaded by user
Build status unknown [no reports yet]

Readme for tasty-leancheck-0.0.1

[back to package description]

tasty-leancheck: LeanCheck support for Tasty

tasty-leancheck's Build Status tasty-leancheck on Hackage tasty-leancheck on Stackage LTS tasty-leancheck on Stackage Nightly

LeanCheck support for the Tasty test framework. Tasty and healthy tests.

Installing

$ cabal install tasty-leancheck

Example

(This example is intentionally similar to Tasty's official example.)

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

import Test.Tasty
import Test.Tasty.LeanCheck as LC
import Data.List

main :: IO ()
main = defaultMain tests

tests :: TestTree
tests = testGroup "Test properties checked by LeanCheck"
  [ LC.testProperty "sort == sort . reverse" $
      \list -> sort (list :: [Int]) == sort (reverse list)
  , LC.testProperty "Fermat's little theorem" $
      \x -> ((x :: Integer)^7 - x) `mod` 7 == 0
  -- the following property do not hold
  , LC.testProperty "Fermat's last theorem" $
      \x y z n ->
        (n :: Integer) >= 3 LC.==> x^n + y^n /= (z^n :: Integer)
  ]

And here is the output for the above program:

$ ./test
Test properties checked by LeanCheck
  sort == sort . reverse:  OK
    +++ OK, passed 200 tests.
  Fermat's little theorem: OK
    +++ OK, passed 200 tests.
  Fermat's last theorem:   FAIL
    *** Failed! Falsifiable (after 71 tests):
    0 0 0 3

1 out of 3 tests failed (0.00s)

Options

The tasty-leancheck provider has only one option, --leancheck-tests:

$ ./test --leancheck-tests 10
Test properties checked by LeanCheck
  sort == sort . reverse:  OK
    +++ OK, passed 10 tests.
  Fermat's little theorem: OK
    +++ OK, passed 10 tests.
  Fermat's last theorem:   OK
    +++ OK, passed 10 tests.

All 3 tests passed (0.00s)

Further reading