fitspec-0.4.3: refining property sets for testing Haskell programs

Copyright(c) 2015-2017 Rudy Matela
License3-Clause BSD (see the file LICENSE)
MaintainerRudy Matela <rudy@matela.com.br>
Safe HaskellNone
LanguageHaskell2010

Test.FitSpec.Report

Description

Generate FitSpec reports.

Synopsis

Documentation

report :: (Mutable a, ShowMutable a) => a -> (a -> [Property]) -> IO () Source #

Report results generated by FitSpec. Uses standard configuration (see args). Needs a function to be mutated and a property map. Example (specification of boolean negation):

properties not =
  [ property $ \p -> not (not p) == p
  , property $ \p -> not (not (not p)) == not p
  ]

main = report not properties

reportWith :: (Mutable a, ShowMutable a) => Args -> a -> (a -> [Property]) -> IO () Source #

Same as report but can be configured via Args (args or fixargs), e.g.:

reportWith args { timeout = 10 } fun properties

reportWithExtra :: (Mutable a, ShowMutable a) => [a] -> Args -> a -> (a -> [Property]) -> IO () Source #

Same as reportWith, but accepts a list of manually defined (extra) mutants to be tested alongside those automatically generated.

data Args Source #

Extra arguments / configuration for reportWith. See args for default values.

Constructors

Args 

Fields

args :: Args Source #

Default arguments for reportWith:

  • nMutants = 500, start with 500 mutants
  • nTests = 1000, start with 1000 test values
  • timeout = 5, keep incresing the number of mutants until 5 seconds elapse
  • names = [], default function call template:
["f x y z", "g x y z", "h x y z", ...]

fixargs :: Int -> Int -> Args Source #

Non timed-out default arguments. Make conjectures based on a fixed number of mutants and tests, e.g.:

reportWith (fixargs 100 200) f pmap

This is just a shorthand, see:

fixargs nm nt  =  args { nMutants = nm, nTests = nt, timeout = 0 }
(fixargs nm nt) { nMutants = 500, nTests = 1000, timeout = 5 }  =  args

type Property = [([String], Bool)] Source #

An encoded representation of a property suitable for use by FitSpec.

Each list of strings is a printable representation of one possible choice of argument values for the property. Each boolean indicate whether the property holds for this choice.

data ShowMutantAs Source #

How to show mutants. Use this to fill showMutantAs.