packages feed

fitspec 0.3.0 → 0.3.1

raw patch · 15 files changed

+68/−26 lines, 15 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

README.md view
@@ -37,7 +37,7 @@  We provide the above properties to FitSpec in the following program: -    import FitSpec+    import Test.FitSpec     import Data.List      properties sort =@@ -139,9 +139,9 @@   [Listable]:    https://hackage.haskell.org/package/leancheck/docs/Test-LeanCheck.html#t:Listable-[Mutable]:     https://hackage.haskell.org/package/fitspec/docs/FitSpec.html#t:Mutable-[ShowMutable]: https://hackage.haskell.org/package/fitspec/docs/FitSpec.html#t:ShowMutable-[FitSpec API]: https://hackage.haskell.org/package/fitspec/docs/FitSpec.html+[Mutable]:     https://hackage.haskell.org/package/fitspec/docs/Test-FitSpec.html#t:Mutable+[ShowMutable]: https://hackage.haskell.org/package/fitspec/docs/Test-FitSpec.html#t:ShowMutable+[FitSpec API]: https://hackage.haskell.org/package/fitspec/docs/Test-FitSpec.html  [leancheck]: https://hackage.haskell.org/package/leancheck [cmdargs]:   https://hackage.haskell.org/package/cmdargs
TODO.md view
@@ -6,6 +6,9 @@  * (?) announce on mailing list (wait for Haddock to be ready) +* parameterize number of tests in test programs and add slow-test target++* add diff test for IO functions (diff w/ model output and exit status)  documentation -------------
doc/tutorial-property-creation.md view
@@ -8,7 +8,7 @@  We first import what is needed: -	import FitSpec+	import Test.FitSpec 	import Data.List (sort)  
fitspec.cabal view
@@ -1,5 +1,5 @@ name:                fitspec-version:             0.3.0+version:             0.3.1 synopsis:            refining property sets for testing Haskell programs description:   FitSpec provides automated assistance in the task of refining test properties@@ -38,7 +38,7 @@ source-repository this   type:            git   location:        https://github.com/rudymatela/fitspec-  tag:             v0.3.0+  tag:             v0.3.1   library
src/Test/FitSpec.hs view
@@ -1,4 +1,4 @@--- | FitSpec: refining property-sets for functional testing+-- | __ FitSpec: refining property-sets for functional testing __ -- -- FitSpec provides automated assistance in the task of refining test properties -- for Haskell functions.  FitSpec tests mutant variations of functions under test@@ -14,7 +14,7 @@ -- -- Example, refining a @sort@ specification: ----- > import FitSpec+-- > import Test.FitSpec -- > import Data.List (sort) -- > -- > properties sort =@@ -34,6 +34,7 @@ -- >                      , timeout  = 0 -- >                      } -- >                 (sort::[Word2]->[Word2])+-- >                 properties -- -- The above program reports the following: --
src/Test/FitSpec/Derive.hs view
@@ -1,11 +1,14 @@--- | Experimental module for deriving Mutable instances+-- | Experimental module for deriving 'Mutable' and 'ShowMutable' instances -- -- Needs GHC and Template Haskell -- (tested on GHC 7.4, 7.6, 7.8, 7.10 and 8.0) ----- Despite Mutable instances being actually very simple, this module can be--- used to derive those.  However, it will not work on all cases: when that--- happens, you should write your instances manually.+-- Despite 'Mutable' instances being actually very simple to write manually,+-- this module can be used to derive those instances automatically.+-- However, it will not work on all cases:+-- when that happens, you should write your instances manually.+--+-- If FitSpec does not compile under later GHCs, this module is probably the culprit. {-# LANGUAGE TemplateHaskell, CPP #-} module Test.FitSpec.Derive   ( deriveMutable@@ -36,7 +39,33 @@     then return []     else deriveListable t --- | Derives a Mutable instance for a given type 'Name'.+-- | Derives 'Mutable', 'ShowMutable' and (optionally) 'Listable' instances+--   for a given type 'Name'.+--+-- Consider the following @Stack@ datatype:+--+-- > data Stack a = Stack a (Stack a) | Empty+--+-- Writing+--+-- > deriveMutable ''Stack+--+-- will automatically derive the following+-- 'Listable', 'Mutable' and 'ShowMutable' instances:+--+-- > instance Listable a => Listable (Stack a) where+-- >   tiers = cons2 Stack \/ cons0 Empty+-- >+-- > instance (Eq a, Listable a) => Mutable a+-- >   where mutiers = mutiersEq+-- >+-- > instance (Eq a, Show a) => ShowMutable a+-- >   where mutantS = mutantSEq+--+-- If a 'Listable' instance already exists, it is not derived.+-- (cf.: 'deriveListable')+--+-- Needs the @TemplateHaskell@ extension. deriveMutable :: Name -> DecsQ deriveMutable = deriveMutableE [] @@ -54,6 +83,8 @@       cd <- canDeriveMutable t       unless cd (fail $ "Unable to derive Mutable " ++ show t)       liftM2 (++) (deriveListableIfNeeded t) (reallyDeriveMutable cs t)+-- TODO: document deriveMutableE with an example+-- TODO: create deriveListableE on LeanCheck?  -- | Checks whether it is possible to derive a Mutable instance. canDeriveMutable :: Name -> Q Bool
src/Test/FitSpec/Dot.hs view
@@ -1,4 +1,5 @@--- | Generate dotfiles (graphviz)+-- | Experimental module to generate dotfiles (for graphviz) with implications+--   between property sub-sets. module Test.FitSpec.Dot where  import Test.FitSpec
src/Test/FitSpec/Engine.hs view
@@ -215,7 +215,7 @@                        . transpose                        . map (compositions . pmap) --- | 'nSurv' @props fs@ returns the number of values that match+-- | @nSurv props fs@ returns the number of values that match --   compositions of properties on the property map. -- -- * @props@ should be a function from a value to a list of properties that@@ -228,6 +228,8 @@ -- -- This function is otherwise unused in this file.  It is just a simpler -- version of 'pssurv' to serve as documentation.+--+-- It is also not exported! nSurv :: (a -> [Bool]) -> [a] -> [Int] nSurv props = map (count id)             . transpose
src/Test/FitSpec/Mutable.hs view
@@ -37,7 +37,7 @@ -- -- > tail mutiers ----- Given that the underlying 'Listable' enumeration has no repetitions+-- Given that the underlying 'Listable' enumeration has no repetitions, -- parametric instances defined in this file will have no repeated mutants. class Mutable a where   mutiers :: a -> [[a]]
src/Test/FitSpec/Mutable/Tuples.hs view
@@ -1,7 +1,11 @@ -- | Mutable instances: septuples up to 12-tuples ----- This is part of a Hack that allows those instances to be hidden from Haddock.+-- This is partly a Hack that allows those instances to be hidden from Haddock. -- Otherwise Haddock documentation will look very ugly.+-- It also makes "Test.FitSpec.ShowMutable" more readable.+--+-- This module is already exported by "Test.FitSpec",+-- so it is not needed to import this explictly. module Test.FitSpec.Mutable.Tuples () where  import Test.FitSpec.Mutable
src/Test/FitSpec/PrettyPrint.hs view
@@ -1,7 +1,4 @@--- | Poor man's pretty printing library------ This module has somewhat inefficient implementations that could be improved--- in the future.  i.e.: heavy use of '(++)'.+-- | A very simple pretty printing library used to generate 'Test.FitSpec' reports. module Test.FitSpec.PrettyPrint   ( beside   , above@@ -13,6 +10,7 @@   , headToUpper   ) where+-- TODO: Fix somewhat inefficient implementations, i.e.: heavy use of '(++)'.  import Data.List (intercalate,transpose,isSuffixOf) import Data.Char (toUpper)
src/Test/FitSpec/Report.hs view
@@ -1,3 +1,4 @@+-- | Generate 'Test.FitSpec' reports. module Test.FitSpec.Report   ( report   , reportWith
src/Test/FitSpec/ShowMutable.hs view
@@ -161,7 +161,7 @@ isFunction (Function _) = True isFunction _            = False --- | Flatten a MutantS by merging nested 'Function's.+-- Flatten a MutantS by merging nested 'Function's. flatten :: MutantS -> MutantS flatten (Tuple ms) = Tuple $ map flatten ms flatten (Function [([],s)])  = flatten s@@ -191,7 +191,7 @@         show1 _  m             = showMutantS m showMutantSAsTuple ns m = showMutantSAsTuple ns (Tuple [m]) --- | Show top-level (maybe tuple) named 'MutantS' as a bindings.+-- Show top-level (maybe tuple) named 'MutantS' as a bindings. -- In general, you want to 'flatten' the 'MutantS' before applying this -- function. showMutantSBindings :: Bool -> [String] -> MutantS -> String
src/Test/FitSpec/ShowMutable/Tuples.hs view
@@ -1,7 +1,8 @@ -- | ShowMutable instances: septuples up to 12-tuples ----- This is part of a Hack that allows those instances to be hidden from Haddock.+-- This is partly a Hack that allows those instances to be hidden from Haddock. -- Otherwise Haddock documentation will look very ugly.+-- It also makes "Test.FitSpec.ShowMutable" more readable. module Test.FitSpec.ShowMutable.Tuples () where  import Test.FitSpec.ShowMutable
src/Test/FitSpec/TestTypes.hs view
@@ -3,7 +3,7 @@ -- 'Int2', 'Int3', 'Int4', -- 'UInt2', 'UInt3', 'UInt4'. ----- This module basically re-exports LeanCheck's Test.Types module+-- This module re-exports "Test.LeanCheck.Utils.Types" module -- and defines 'Mutable' and 'ShowMutable' instances for the types -- defined there. module Test.FitSpec.TestTypes (module Test.LeanCheck.Utils.Types) where