leancheck 0.6.1 → 0.6.2
raw patch · 28 files changed
+208/−33 lines, 28 files
Files
- README.md +8/−0
- TODO.md +7/−3
- leancheck.cabal +3/−3
- src/Test/LeanCheck.hs +9/−4
- src/Test/LeanCheck/Basic.hs +8/−2
- src/Test/LeanCheck/Core.hs +7/−1
- src/Test/LeanCheck/Derive.hs +8/−1
- src/Test/LeanCheck/Error.hs +8/−1
- src/Test/LeanCheck/Function.hs +8/−1
- src/Test/LeanCheck/Function/CoListable.hs +11/−3
- src/Test/LeanCheck/Function/Eq.hs +9/−0
- src/Test/LeanCheck/Function/ListsOfPairs.hs +11/−3
- src/Test/LeanCheck/Function/Periodic.hs +11/−2
- src/Test/LeanCheck/Function/Show.hs +10/−1
- src/Test/LeanCheck/Function/ShowFunction.hs +11/−2
- src/Test/LeanCheck/IO.hs +10/−1
- src/Test/LeanCheck/Invariants.hs +10/−1
- src/Test/LeanCheck/Tiers.hs +7/−1
- src/Test/LeanCheck/Utils.hs +10/−1
- src/Test/LeanCheck/Utils/Operators.hs +10/−0
- src/Test/LeanCheck/Utils/TypeBinding.hs +10/−1
- src/Test/LeanCheck/Utils/Types.hs +10/−1
- tests/test-derive.hs +2/−0
- tests/test-error.hs +2/−0
- tests/test-operators.hs +2/−0
- tests/test-tiers.hs +2/−0
- tests/test-types.hs +2/−0
- tests/test.hs +2/−0
README.md view
@@ -1,6 +1,9 @@ LeanCheck ========= +[![Build Status][build-status]][build-log]+[![Hackage version][hackage-version]][leancheck-on-hackage]+ LeanCheck is a simple enumerative [property-based testing] library. Properties are defined as Haskell functions returning a boolean value which should be `True` for all possible choices of argument values. LeanCheck applies@@ -20,6 +23,7 @@ To install the latest LeanCheck version from Hackage, just run: + $ cabal update $ cabal install leancheck @@ -154,3 +158,7 @@ [SmallCheck]: https://hackage.haskell.org/package/smallcheck [QuickCheck]: https://hackage.haskell.org/package/QuickCheck +[build-status]: https://travis-ci.org/rudymatela/leancheck.svg?branch=master+[build-log]: https://travis-ci.org/rudymatela/leancheck+[hackage-version]: https://img.shields.io/hackage/v/leancheck.svg+[leancheck-on-hackage]: https://hackage.haskell.org/package/leancheck
TODO.md view
@@ -29,13 +29,17 @@ * on data-invariant.md, write missing section; -v0.6.2+v0.6.3 ------ -* add copyright notices on modules using Haddock markup+* add `classify` function to measure distribution of data:+ something like: + classifyBy :: (a -> b) -> [a] -> [(b,a)]+ countsBy :: (a -> b) -> [a] -> [(b,Int)] -v0.6.3++v0.6.4 ------ * implement stub `Test.LeanCheck.Function.*` modules;
leancheck.cabal view
@@ -1,4 +1,4 @@--- LeanCheck+-- Cabal file for LeanCheck -- -- Template Haskell dependency is optional. To deactivate it: -- 1. In this file, comment out:@@ -11,7 +11,7 @@ -- this cabal file too complicated. -- Rudy name: leancheck-version: 0.6.1+version: 0.6.2 synopsis: Cholesterol-free property-based testing description: LeanCheck is a simple enumerative property-based testing library.@@ -50,7 +50,7 @@ source-repository this type: git location: https://github.com/rudymatela/leancheck- tag: v0.6.1+ tag: v0.6.2 library exposed-modules: Test.LeanCheck
src/Test/LeanCheck.hs view
@@ -1,6 +1,12 @@ {-# OPTIONS_HADDOCK prune #-}--- | LeanCheck is a simple enumerative property-based testing library.+-- |+-- Module : Test.LeanCheck+-- Copyright : (c) 2015-2017 Rudy Matela+-- License : 3-Clause BSD (see the file LICENSE)+-- Maintainer : Rudy Matela <rudy@matela.com.br> --+-- LeanCheck is a simple enumerative property-based testing library.+-- -- A __property__ is a function returning a 'Bool' that should be 'True' for -- all possible choices of arguments. Properties can be viewed as a -- parameterized unit tests.@@ -15,7 +21,7 @@ -- -- For example: ----- > holds $ \xs -> length (sort xs) == length (xs::[Int])+-- > holds 1000 $ \xs -> length (sort xs) == length (xs::[Int]) -- -- -- To get the smallest 'counterExample' by testing up to a thousand values,@@ -26,8 +32,7 @@ -- -- Arguments of properties should be instances of the 'Listable' typeclass. -- 'Listable' instances are provided for the most common Haskell types.--- New instances are easily defined--- (see 'Listable' for more info).+-- New instances are easily defined (see 'Listable' for more info). module Test.LeanCheck ( -- * Checking and testing
src/Test/LeanCheck/Basic.hs view
@@ -1,5 +1,11 @@--- | This module is part of LeanCheck,--- a simple enumerative property-based testing library.+-- |+-- Module : Test.LeanCheck.Basic+-- Copyright : (c) 2015-2017 Rudy Matela+-- License : 3-Clause BSD (see the file LICENSE)+-- Maintainer : Rudy Matela <rudy@matela.com.br>+--+-- This module is part of LeanCheck,+-- a simple enumerative property-based testing library. -- -- This module exports "Test.LeanCheck.Core" along with: --
src/Test/LeanCheck/Core.hs view
@@ -1,4 +1,10 @@--- | LeanCheck is a simple enumerative property-based testing library.+-- |+-- Module : Test.LeanCheck.Core+-- Copyright : (c) 2015-2017 Rudy Matela+-- License : 3-Clause BSD (see the file LICENSE)+-- Maintainer : Rudy Matela <rudy@matela.com.br>+--+-- LeanCheck is a simple enumerative property-based testing library. -- -- This is the core module of the library, with the most basic definitions. If -- you are looking just to use the library, import and see "Test.LeanCheck".
src/Test/LeanCheck/Derive.hs view
@@ -1,5 +1,12 @@ {-# LANGUAGE TemplateHaskell, CPP #-}--- | LeanCheck is a simple enumerative property-based testing library.+-- |+-- Module : Test.LeanCheck.Derive+-- Copyright : (c) 2015-2017 Rudy Matela+-- License : 3-Clause BSD (see the file LICENSE)+-- Maintainer : Rudy Matela <rudy@matela.com.br>+--+-- This module is part of LeanCheck,+-- a simple enumerative property-based testing library. -- -- This is an experimental module for deriving 'Listable' instances. --
src/Test/LeanCheck/Error.hs view
@@ -1,4 +1,11 @@--- | LeanCheck is a simple enumerative property-based testing library.+-- |+-- Module : Test.LeanCheck.Error+-- Copyright : (c) 2015-2017 Rudy Matela+-- License : 3-Clause BSD (see the file LICENSE)+-- Maintainer : Rudy Matela <rudy@matela.com.br>+--+-- This module is part of LeanCheck,+-- a simple enumerative property-based testing library. -- -- This module re-exports "Test.LeanCheck" but some test functions have been -- specialized to catch errors (see the explicit export list below).
src/Test/LeanCheck/Function.hs view
@@ -1,4 +1,11 @@--- | LeanCheck is a simple enumerative property-based testing library.+-- |+-- Module : Test.LeanCheck.Function+-- Copyright : (c) 2015-2017 Rudy Matela+-- License : 3-Clause BSD (see the file LICENSE)+-- Maintainer : Rudy Matela <rudy@matela.com.br>+--+-- This module is part of LeanCheck,+-- a simple enumerative property-based testing library. -- -- This module exports 'Listable' and 'Show' function typeclass instances. -- These can be useful for testing higher-order properties --- properties that
src/Test/LeanCheck/Function/CoListable.hs view
@@ -1,6 +1,14 @@--- | This module is part of 'Test.LeanCheck'.--- It exports a 'Listable' instance for function enumeration--- by means of a 'CoListable' typeclass.+-- |+-- Module : Test.LeanCheck.CoListable+-- Copyright : (c) 2015-2017 Rudy Matela+-- License : 3-Clause BSD (see the file LICENSE)+-- Maintainer : Rudy Matela <rudy@matela.com.br>+--+-- This module is part of LeanCheck,+-- a simple enumerative property-based testing library.+--+-- This module exports a 'Listable' instance for function enumeration by means+-- of a 'CoListable' typeclass. -- -- This module /does not currently work/, it it just a sketch and a stub. module Test.LeanCheck.Function.CoListable
src/Test/LeanCheck/Function/Eq.hs view
@@ -1,3 +1,12 @@+-- |+-- Module : Test.LeanCheck.Function.Eq+-- Copyright : (c) 2015-2017 Rudy Matela+-- License : 3-Clause BSD (see the file LICENSE)+-- Maintainer : Rudy Matela <rudy@matela.com.br>+--+-- This module is part of LeanCheck,+-- a simple enumerative property-based testing library.+-- -- A toy Eq instance for Functions. module Test.LeanCheck.Function.Eq () where
src/Test/LeanCheck/Function/ListsOfPairs.hs view
@@ -1,6 +1,14 @@--- | This module is part of 'Test.LeanCheck'.--- It exports a 'Listable' instance for function enumeration--- via lists of pairs.+-- |+-- Module : Test.LeanCheck.Function.ListsOfPairs+-- Copyright : (c) 2015-2017 Rudy Matela+-- License : 3-Clause BSD (see the file LICENSE)+-- Maintainer : Rudy Matela <rudy@matela.com.br>+--+-- This module is part of LeanCheck,+-- a simple enumerative property-based testing library.+--+-- This module exports a 'Listable' instance for function enumeration+-- via lists of pairs. -- -- This module considers functions as a finite list of exceptional input-output -- cases to a default value (list of pairs of arguments and results).
src/Test/LeanCheck/Function/Periodic.hs view
@@ -1,5 +1,14 @@--- | This module is part of 'Test.LeanCheck'.--- It exports a 'Listable' instance for enumeration of periodic functions.+-- |+-- Module : Test.LeanCheck.Function.Periodic+-- Copyright : (c) 2015-2017 Rudy Matela+-- License : 3-Clause BSD (see the file LICENSE)+-- Maintainer : Rudy Matela <rudy@matela.com.br>+--+-- This module is part of LeanCheck,+-- a simple enumerative property-based testing library.+--+-- This module exports a 'Listable' instance for enumeration of periodic+-- functions. -- -- This module /barely works/ and is just a sketch. module Test.LeanCheck.Function.Periodic
src/Test/LeanCheck/Function/Show.hs view
@@ -1,4 +1,13 @@--- | A 'Show' instance for functions.+-- |+-- Module : Test.LeanCheck.Function.Show+-- Copyright : (c) 2015-2017 Rudy Matela+-- License : 3-Clause BSD (see the file LICENSE)+-- Maintainer : Rudy Matela <rudy@matela.com.br>+--+-- This module is part of LeanCheck,+-- a simple enumerative property-based testing library.+--+-- A 'Show' instance for functions. module Test.LeanCheck.Function.Show () where import Test.LeanCheck.Function.ShowFunction
src/Test/LeanCheck/Function/ShowFunction.hs view
@@ -1,5 +1,14 @@--- | This module exports the 'ShowFunction' typeclass,--- its instances and related functions.+-- |+-- Module : Test.LeanCheck.Function.ShowFunction+-- Copyright : (c) 2015-2017 Rudy Matela+-- License : 3-Clause BSD (see the file LICENSE)+-- Maintainer : Rudy Matela <rudy@matela.com.br>+--+-- This module is part of LeanCheck,+-- a simple enumerative property-based testing library.+--+-- This module exports the 'ShowFunction' typeclass,+-- its instances and related functions. -- -- Using this module, it is possible to implement -- a Show instance for functions:
src/Test/LeanCheck/IO.hs view
@@ -1,4 +1,13 @@--- | QuickCheck-like interface to 'Test.LeanCheck'+-- |+-- Module : Test.LeanCheck.IO+-- Copyright : (c) 2015-2017 Rudy Matela+-- License : 3-Clause BSD (see the file LICENSE)+-- Maintainer : Rudy Matela <rudy@matela.com.br>+--+-- This module is part of LeanCheck,+-- a simple enumerative property-based testing library.+--+-- QuickCheck-like interface to "Test.LeanCheck" {-# LANGUAGE CPP #-} module Test.LeanCheck.IO ( check
src/Test/LeanCheck/Invariants.hs view
@@ -1,4 +1,13 @@--- | Some invariants over Test.LeanCheck functions.+-- |+-- Module : Test.LeanCheck.Invariants+-- Copyright : (c) 2015-2017 Rudy Matela+-- License : 3-Clause BSD (see the file LICENSE)+-- Maintainer : Rudy Matela <rudy@matela.com.br>+--+-- This module is part of LeanCheck,+-- a simple enumerative property-based testing library.+--+-- Some invariants about Test.LeanCheck functions. -- -- You should be importing this ONLY to test "Test.LeanCheck" itself. module Test.LeanCheck.Invariants
src/Test/LeanCheck/Tiers.hs view
@@ -1,4 +1,10 @@--- | LeanCheck is a simple enumerative property-based testing library.+-- |+-- Module : Test.LeanCheck.Tiers+-- Copyright : (c) 2015-2017 Rudy Matela+-- License : 3-Clause BSD (see the file LICENSE)+-- Maintainer : Rudy Matela <rudy@matela.com.br>+--+-- LeanCheck is a simple enumerative property-based testing library. -- -- This module provides advanced functions for manipulating 'tiers'. -- Most definitions given here are exported by "Test.LeanCheck", except:
src/Test/LeanCheck/Utils.hs view
@@ -1,4 +1,13 @@--- | Some utilities for property-based testing with 'Test.LeanCheck'.+-- |+-- Module : Test.LeanCheck.Utils+-- Copyright : (c) 2015-2017 Rudy Matela+-- License : 3-Clause BSD (see the file LICENSE)+-- Maintainer : Rudy Matela <rudy@matela.com.br>+--+-- This module is part of LeanCheck,+-- a simple enumerative property-based testing library.+--+-- Some utilities for property-based testing with 'Test.LeanCheck'. -- -- Those utilities are general-purpose enough to be used with other -- property-based based testing libraries. See each exported module for
src/Test/LeanCheck/Utils/Operators.hs view
@@ -1,3 +1,13 @@+-- |+-- Module : Test.LeanCheck.Utils.Operators+-- Copyright : (c) 2015-2017 Rudy Matela+-- License : 3-Clause BSD (see the file LICENSE)+-- Maintainer : Rudy Matela <rudy@matela.com.br>+--+-- This module is part of LeanCheck,+-- a simple enumerative property-based testing library.+--+-- Some operators for property-based testing. module Test.LeanCheck.Utils.Operators ( -- (==>) -- already provided by Test.LeanCheck
src/Test/LeanCheck/Utils/TypeBinding.hs view
@@ -1,4 +1,13 @@--- | Infix operators for type binding using dummy first-class values.+-- |+-- Module : Test.LeanCheck.Utils.TypeBinding+-- Copyright : (c) 2015-2017 Rudy Matela+-- License : 3-Clause BSD (see the file LICENSE)+-- Maintainer : Rudy Matela <rudy@matela.com.br>+--+-- This module is part of LeanCheck,+-- a simple enumerative property-based testing library.+--+-- Infix operators for type binding using dummy first-class values. -- -- Those are useful when property based testing to avoid repetition. -- Suppose:
src/Test/LeanCheck/Utils/Types.hs view
@@ -1,4 +1,13 @@--- | Types to aid in property-based testing.+-- |+-- Module : Test.LeanCheck.Utils.Types+-- Copyright : (c) 2015-2017 Rudy Matela+-- License : 3-Clause BSD (see the file LICENSE)+-- Maintainer : Rudy Matela <rudy@matela.com.br>+--+-- This module is part of LeanCheck,+-- a simple enumerative property-based testing library.+--+-- Types to aid in property-based testing. module Test.LeanCheck.Utils.Types ( -- * Integer types
tests/test-derive.hs view
@@ -1,3 +1,5 @@+-- Copyright (c) 2015-2017 Rudy Matela.+-- Distributed under the 3-Clause BSD licence (see the file LICENSE). {-# LANGUAGE TemplateHaskell, CPP #-} import Test.LeanCheck.Derive import Test.LeanCheck
tests/test-error.hs view
@@ -1,3 +1,5 @@+-- Copyright (c) 2015-2017 Rudy Matela.+-- Distributed under the 3-Clause BSD licence (see the file LICENSE). import System.Exit (exitFailure) import Data.List (elemIndices,sort)
tests/test-operators.hs view
@@ -1,3 +1,5 @@+-- Copyright (c) 2015-2017 Rudy Matela.+-- Distributed under the 3-Clause BSD licence (see the file LICENSE). import System.Exit (exitFailure) import Data.List (elemIndices,sort) import Test.LeanCheck
tests/test-tiers.hs view
@@ -1,3 +1,5 @@+-- Copyright (c) 2015-2017 Rudy Matela.+-- Distributed under the 3-Clause BSD licence (see the file LICENSE). import System.Exit (exitFailure) import Data.List (elemIndices, sort, nub, delete)
tests/test-types.hs view
@@ -1,3 +1,5 @@+-- Copyright (c) 2015-2017 Rudy Matela.+-- Distributed under the 3-Clause BSD licence (see the file LICENSE). import System.Exit (exitFailure) import Data.List (elemIndices,delete) import Test.LeanCheck.Utils.Types
tests/test.hs view
@@ -1,3 +1,5 @@+-- Copyright (c) 2015-2017 Rudy Matela.+-- Distributed under the 3-Clause BSD licence (see the file LICENSE). import System.Exit (exitFailure) import Data.List (elemIndices)