leancheck 0.6.3 → 0.6.4
raw patch · 6 files changed
+145/−7 lines, 6 files
Files
- README.md +9/−2
- TODO.md +4/−2
- leancheck.cabal +2/−2
- src/Test/LeanCheck/Utils/TypeBinding.hs +90/−0
- src/Test/LeanCheck/Utils/Types.hs +7/−1
- tests/test-types.hs +33/−0
README.md view
@@ -1,8 +1,10 @@ LeanCheck ========= -[![Build Status][build-status]][build-log]-[![Hackage version][hackage-version]][leancheck-on-hackage]+[![LeanCheck's Build Status][build-status]][build-log]+[![LeanCheck on Hackage][hackage-version]][leancheck-on-hackage]+[![LeanCheck on Stackage LTS][stackage-lts-badge]][leancheck-on-stackage-lts]+[![LeanCheck on Stackage Nightly][stackage-nightly-badge]][leancheck-on-stackage-nightly] LeanCheck is a simple enumerative [property-based testing] library. Properties are defined as Haskell functions returning a boolean value which should be@@ -162,3 +164,8 @@ [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+[stackage-lts-badge]: http://stackage.org/package/leancheck/badge/lts+[stackage-nightly-badge]: http://stackage.org/package/leancheck/badge/nightly+[leancheck-on-stackage]: http://stackage.org/package/leancheck+[leancheck-on-stackage-lts]: http://stackage.org/lts/package/leancheck+[leancheck-on-stackage-nightly]: http://stackage.org/nightly/package/leancheck
TODO.md view
@@ -39,9 +39,11 @@ * on data-invariant.md, write missing section; -v0.6.4+v0.6.5 ------ +* Document `X` and `Xs` on `Utils.Types`.+ * On `bench/tiers`, print if the enumeration has repetitions (import `Function.Eq` for that) @@ -79,7 +81,7 @@ so that the user gets an enumeration of functions with repetitions, but using a mixed strategy for generation of values. -v0.6.5+v0.6.6 ------ * implement stub `Test.LeanCheck.Function.*` modules;
leancheck.cabal view
@@ -11,7 +11,7 @@ -- this cabal file too complicated. -- Rudy name: leancheck-version: 0.6.3+version: 0.6.4 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.3+ tag: v0.6.4 library exposed-modules: Test.LeanCheck
src/Test/LeanCheck/Utils/TypeBinding.hs view
@@ -65,6 +65,24 @@ , (->>:) , (->>:>) , (->>>:)+ , (->>>:>)+ , (->>>>:)+ , (->>>>:>)+ , (->>>>>:)+ , (->>>>>:>)+ , (->>>>>>:)+ , (->>>>>>:>)+ , (->>>>>>>:)+ , (->>>>>>>:>)+ , (->>>>>>>>:)+ , (->>>>>>>>:>)+ , (->>>>>>>>>:)+ , (->>>>>>>>>:>)+ , (->>>>>>>>>>:)+ , (->>>>>>>>>>:>)+ , (->>>>>>>>>>>:)+ , (->>>>>>>>>>>:>)+ , (->>>>>>>>>>>>:) -- * Dummy (undefined) values -- ** Standard Haskell types@@ -157,6 +175,78 @@ (->>>:) :: (a -> b -> c -> d) -> d -> (a -> b -> c -> d) (->>>:) = const infixl 1 ->>>:++(->>>:>) :: (a -> b -> c -> d -> e) -> d -> (a -> b -> c -> d -> e)+(->>>:>) = const+infixl 1 ->>>:>++(->>>>:) :: (a -> b -> c -> d -> e) -> e -> (a -> b -> c -> d -> e)+(->>>>:) = const+infixl 1 ->>>>:++(->>>>:>) :: (a -> b -> c -> d -> e -> f) -> e -> (a -> b -> c -> d -> e -> f)+(->>>>:>) = const+infixl 1 ->>>>:>++(->>>>>:) :: (a -> b -> c -> d -> e -> f) -> f -> (a -> b -> c -> d -> e -> f)+(->>>>>:) = const+infixl 1 ->>>>>:++(->>>>>:>) :: (a->b->c->d->e->f->g) -> f -> (a->b->c->d->e->f->g)+(->>>>>:>) = const+infixl 1 ->>>>>:>++(->>>>>>:) :: (a->b->c->d->e->f->g) -> g -> (a->b->c->d->e->f->g)+(->>>>>>:) = const+infixl 1 ->>>>>>:++(->>>>>>:>) :: (a->b->c->d->e->f->g->h) -> g -> (a->b->c->d->e->f->g->h)+(->>>>>>:>) = const+infixl 1 ->>>>>>:>++(->>>>>>>:) :: (a->b->c->d->e->f->g->h) -> h -> (a->b->c->d->e->f->g->h)+(->>>>>>>:) = const+infixl 1 ->>>>>>>:++(->>>>>>>:>) :: (a->b->c->d->e->f->g->h->i) -> h -> (a->b->c->d->e->f->g->h->i)+(->>>>>>>:>) = const+infixl 1 ->>>>>>>:>++(->>>>>>>>:) :: (a->b->c->d->e->f->g->h->i) -> i -> (a->b->c->d->e->f->g->h->i)+(->>>>>>>>:) = const+infixl 1 ->>>>>>>>:++(->>>>>>>>:>) :: (a->b->c->d->e->f->g->h->i->j) -> i -> (a->b->c->d->e->f->g->h->i->j)+(->>>>>>>>:>) = const+infixl 1 ->>>>>>>>:>++(->>>>>>>>>:) :: (a->b->c->d->e->f->g->h->i->j) -> j -> (a->b->c->d->e->f->g->h->i->j)+(->>>>>>>>>:) = const+infixl 1 ->>>>>>>>>:++(->>>>>>>>>:>) :: (a->b->c->d->e->f->g->h->i->j->k) -> j -> (a->b->c->d->e->f->g->h->i->j->k)+(->>>>>>>>>:>) = const+infixl 1 ->>>>>>>>>:>++(->>>>>>>>>>:) :: (a->b->c->d->e->f->g->h->i->j->k) -> k -> (a->b->c->d->e->f->g->h->i->j->k)+(->>>>>>>>>>:) = const+infixl 1 ->>>>>>>>>>:++(->>>>>>>>>>:>) :: (a->b->c->d->e->f->g->h->i->j->k->l) -> k -> (a->b->c->d->e->f->g->h->i->j->k->l)+(->>>>>>>>>>:>) = const+infixl 1 ->>>>>>>>>>:>++(->>>>>>>>>>>:) :: (a->b->c->d->e->f->g->h->i->j->k->l) -> l -> (a->b->c->d->e->f->g->h->i->j->k->l)+(->>>>>>>>>>>:) = const+infixl 1 ->>>>>>>>>>>:++(->>>>>>>>>>>:>) :: (a->b->c->d->e->f->g->h->i->j->k->l->m) -> m -> (a->b->c->d->e->f->g->h->i->j->k->l->m)+(->>>>>>>>>>>:>) = const+infixl 1 ->>>>>>>>>>>:>++(->>>>>>>>>>>>:) :: (a->b->c->d->e->f->g->h->i->j->k->l->m) -> m -> (a->b->c->d->e->f->g->h->i->j->k->l->m)+(->>>>>>>>>>>>:) = const+infixl 1 ->>>>>>>>>>>>: -- | Returns an undefined functional value -- that takes an argument of the type of its first argument
src/Test/LeanCheck/Utils/Types.hs view
@@ -52,6 +52,7 @@ -- * Extreme Integers , X (..)+ , Xs (..) -- * List-wrapper types , NoDup (..)@@ -62,7 +63,7 @@ -- TODO: Add Ix and Bits instances import Test.LeanCheck (Listable(..), listIntegral)-import Test.LeanCheck.Core ((+|))+import Test.LeanCheck.Core ((+|),cons1) import Test.LeanCheck.Tiers (noDupListCons, setCons, bagCons) import Data.Ratio ((%)) @@ -510,3 +511,8 @@ [x] ++| ys = x:ys (x:x':xs) ++| (y:ys) = x:x':y:(xs ++| ys) infixr 5 ++|++newtype Xs a = Xs {unXs :: [a]} deriving (Eq, Ord)+instance Show a => Show (Xs a) where show (Xs xs) = show xs+instance (Integral a, Bounded a) => Listable (Xs a) where+ tiers = cons1 (Xs . map unX)
tests/test-types.hs view
@@ -76,7 +76,19 @@ , (prefiXN :: [Word64]) `isPrefixOf` map (unX) list , (prefiXN :: [Word]) `isPrefixOf` map (unX) list + , (prefiXs :: [[Int8]]) `isPrefixOf` map (unXs) list+ , (prefiXs :: [[Int16]]) `isPrefixOf` map (unXs) list+ , (prefiXs :: [[Int32]]) `isPrefixOf` map (unXs) list+ , (prefiXs :: [[Int64]]) `isPrefixOf` map (unXs) list+ , (prefiXs :: [[Int]]) `isPrefixOf` map (unXs) list + , (prefiXNs :: [[Word8]]) `isPrefixOf` map (unXs) list+ , (prefiXNs :: [[Word16]]) `isPrefixOf` map (unXs) list+ , (prefiXNs :: [[Word32]]) `isPrefixOf` map (unXs) list+ , (prefiXNs :: [[Word64]]) `isPrefixOf` map (unXs) list+ , (prefiXNs :: [[Word]]) `isPrefixOf` map (unXs) list++ , [minBound..maxBound :: Int1] == signedRange 1 , [minBound..maxBound :: Int2] == signedRange 2 , [minBound..maxBound :: Int3] == signedRange 3@@ -113,6 +125,19 @@ , maxBound-2, minBound+2 ] +prefiXs :: (Bounded a, Integral a) => [[a]]+prefiXs =+ [ []+ , [0]+ , [0,0], [1]+ , [0,0,0], [0,1], [1,0], [-1]+ , [0,0,0,0], [0,0,1], [0,1,0], [0,-1], [1,0,0], [1,1], [-1,0], [maxBound]+ , [0,0,0,0,0], [0,0,0,1], [0,0,1,0], [0,0,-1]+ , [0,1,0,0], [0,1,1], [0,-1,0], [0,maxBound]+ , [1,0,0,0], [1,0,1], [1,1,0], [1,-1]+ , [-1,0,0], [-1,1], [maxBound,0], [minBound]+ ]+ prefiXN :: (Bounded a, Integral a) => [a] prefiXN = [ 0@@ -124,6 +149,14 @@ , maxBound-2 ] +prefiXNs :: (Bounded a, Integral a) => [[a]]+prefiXNs =+ [ []+ , [0]+ , [0,0], [1]+ , [0,0,0], [0,1], [1,0], [2]+ , [0,0,0,0], [0,0,1], [0,1,0], [0,2], [1,0,0], [1,1], [2,0], [maxBound]+ ] permutation :: Eq a => [a] -> [a] -> Bool [] `permutation` [] = True