mutagen-0.1.0.0: Property-based testing framework for Haskell using type-preserving mutations.
Safe HaskellNone
LanguageHaskell2010

Test.Mutagen.Config

Description

Configuration options for Mutagen.

Synopsis

Configuration options

data Config Source #

Configuration options for Mutagen.

Constructors

Config 

Fields

  • maxSuccess :: Int

    Max number of passed tests.

  • maxDiscardRatio :: Int

    Max discard ratio.

  • timeout :: Maybe Integer

    Campaign time budget in seconds (has precedence over maxSuccess).

  • expect :: Bool

    Whether the property is expected to hold (True) or to fail (False).

  • maxGenSize :: Int

    Max generation size passed to a generator. It uses the same formula for computing sizes as vanilla QuickCheck when in generation mode. Random mutations are generated using the maximum size.

  • randomMutations :: Int

    Number of times to sample the generator associated to a random mutant. It can be automatically increased over time if autoResetAfter is not set to Nothing.

  • maxMutationDepth :: Maybe Int

    The maximum number of ancestors a test case can have before being discarded. Useful to avoid mutating recursive structures indefinetely. Defaults to maxGenSize if set to Nothing.

  • autoResetAfter :: Maybe Int

    Reset the global trace log if no interesting test case is found after a certain number of tests. If not set to Nothing, this will duplicate the current limit on every reset. Additionally, it also duplicates the randomMutations parameter.

  • lazyPruning :: LazyPruningMode

    Use lazy pruning to avoid mutating unevaluated subexpressions. The target mutable subexpressions are ordered by last evaluated first.

  • mutationOrder :: MutationOrder

    If lazyPruning is set to False, *every* subexpression of an interesting test case is mutated regardless whether it was evaluated or not. These subexpressions are ordered using a generic tree traversal order (level order by default). The provided options are: levelorder, preorder, and postorder, but you're free to define your own tree traversal order if needed.

  • useFragments :: Bool

    Explode the interesting test cases found during the test loop into typed fragments. These fragments can be used to concretize fragment mutants.

  • randomFragments :: Int

    The amount of fragments sampled from the global fragment store when concretizing a fragment mutant. Can return less than randomFragments test cases if there are not enough fragments of the type of the target subexpression to sample from.

  • filterFragments :: FragmentTypeFilter

    Filter to allow or deny values of certain types from being saved in the fragment store.

  • examples :: [Args]

    Initial inputs examples used to populate the global fragment store before the testing loop starts.

  • traceBackend :: TraceBackend

    The tracing mechanism. Either Tree or Bitmap. Tree uses prefix-based traces (quite expensive but more precise). Bitmap uses edge-based traces (cheaper but less precise).

  • maxTraceLength :: Maybe Int

    The maximim trace length to consider. Nodes added beyond this limit will be ignored. This is useful to limit memory consumption when using the Tree TraceBackend while testing lengthy properties.

  • keepGoing :: Bool

    Whether to keep searching for more counterexamples after finding the first one. If set, Mutagen will stop only when reaching the maximum number of successful tests or the timeout, without giving up in the presence of too many discards. Reports will always be a Success.

    NOTE: you probably want to set saveCounterexamples when enabling this.

  • saveCounterexamples :: Maybe FilePath

    If set to a FilePath, save found counterexamples to the given path. Accepts templated file paths via @, e.g., "counterexample_@.hs", where @ is be replaced by a counter. This is useful in combination with keepGoing to save multiple counterexamples over a long testing campaign.

    NOTE: if keepGoing is enabled and the counterexample path does not contain @, then the counter is appended at the end.

  • chatty :: Bool

    Print extra info.

  • debug :: DebugMode

    Whether to enable interactive debugging mode.

  • tui :: Bool

    Whether to use a terminal user interface (TUI) for displaying progress.

defaultConfig :: Config Source #

Default configuration options for Mutagen.

Helpers

allow :: Typeable a => FragmentTypeFilter Source #

Allow a type to be saved in the fragment store.

allow' :: Typeable a => Proxy a -> FragmentTypeFilter Source #

Like allow but taking a Proxy argument.

deny :: Typeable a => FragmentTypeFilter Source #

Deny a type from being saved in the fragment store.

deny' :: Typeable a => Proxy a -> FragmentTypeFilter Source #

Like deny but taking a Proxy argument.

example :: IsArgs a => a -> Args Source #

Helper to create an example input of any supported argument type.

data LazyPruningMode Source #

Lazy pruning mode.

Used to dictate whether lazy pruning is used or not, and in which order subexpressions are mutated.

Constructors

NoLazyPruning

Do not use lazy pruning; mutate all subexpressions.

LazyPruning EvaluationOrder

Use lazy pruning; mutate only evaluated subexpressions, following the order in which they were evaluated.

data EvaluationOrder Source #

Evaluation order for lazy pruning.

Used to dictate how to order the evaluated subexpressions to be mutated.

Constructors

Forward

Mutate the least recently evaluated subexpressions first.

Backward

Mutate the most recently evaluated subexpressions first.

data DebugMode Source #

Debugging mode.

Allows stopping the loop between test cases to inspect the internal state.

Constructors

NoDebug

Run normally without stopping between tests.

StopOnPassed

Stop after every passed test case.

AlwaysStop

Stop after every test case (passed or discarded).

Instances

Instances details
Show DebugMode Source # 
Instance details

Defined in Test.Mutagen.Config

Eq DebugMode Source # 
Instance details

Defined in Test.Mutagen.Config

Re-exports

data TraceBackend Source #

Supported tracing backends.

Constructors

Bitmap

Edge based tracing using a bitmap.

Tree

Path based tracing using a rose tree.