{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
module Test.Mutagen.Config
(
Config (..)
, defaultConfig
, allow
, allow'
, deny
, deny'
, example
, LazyPruningMode (..)
, EvaluationOrder (..)
, DebugMode (..)
, FragmentTypeFilter
, TraceBackend (..)
)
where
import qualified Data.Set as Set
import Data.Typeable (Proxy (..), Typeable, typeRep)
import Test.Mutagen.Fragment.Store (FragmentTypeFilter (..))
import Test.Mutagen.Mutation (MutationOrder, levelorder)
import Test.Mutagen.Property (Args (..), IsArgs)
import Test.Mutagen.Tracer.Store (TraceBackend (..))
data Config
= Config
{ Config -> Int
maxSuccess :: Int
, Config -> Int
maxDiscardRatio :: Int
, Config -> Maybe Integer
timeout :: Maybe Integer
, Config -> Bool
expect :: Bool
, Config -> Int
maxGenSize :: Int
, Config -> Int
randomMutations :: Int
, Config -> Maybe Int
maxMutationDepth :: Maybe Int
, Config -> Maybe Int
autoResetAfter :: Maybe Int
, Config -> LazyPruningMode
lazyPruning :: LazyPruningMode
, Config -> MutationOrder
mutationOrder :: MutationOrder
, Config -> Bool
useFragments :: Bool
, Config -> Int
randomFragments :: Int
, Config -> FragmentTypeFilter
filterFragments :: FragmentTypeFilter
, Config -> [Args]
examples :: [Args]
, Config -> TraceBackend
traceBackend :: TraceBackend
, Config -> Maybe Int
maxTraceLength :: Maybe Int
, Config -> Bool
keepGoing :: Bool
, Config -> Maybe FilePath
saveCounterexamples :: Maybe FilePath
, Config -> Bool
chatty :: Bool
, Config -> DebugMode
debug :: DebugMode
, Config -> Bool
tui :: Bool
}
defaultConfig :: Config
defaultConfig :: Config
defaultConfig =
Config
{ maxSuccess :: Int
maxSuccess = Int
1000000
, maxDiscardRatio :: Int
maxDiscardRatio = Int
1000
, timeout :: Maybe Integer
timeout = Maybe Integer
forall a. Maybe a
Nothing
, expect :: Bool
expect = Bool
True
, maxGenSize :: Int
maxGenSize = Int
10
, randomMutations :: Int
randomMutations = Int
1
, maxMutationDepth :: Maybe Int
maxMutationDepth = Maybe Int
forall a. Maybe a
Nothing
, autoResetAfter :: Maybe Int
autoResetAfter = Int -> Maybe Int
forall a. a -> Maybe a
Just Int
1000
, lazyPruning :: LazyPruningMode
lazyPruning = EvaluationOrder -> LazyPruningMode
LazyPruning EvaluationOrder
Forward
, mutationOrder :: MutationOrder
mutationOrder = Tree a -> [a]
MutationOrder
levelorder
, useFragments :: Bool
useFragments = Bool
False
, randomFragments :: Int
randomFragments = Int
10
, filterFragments :: FragmentTypeFilter
filterFragments = FragmentTypeFilter
forall a. Monoid a => a
mempty
, examples :: [Args]
examples = []
, traceBackend :: TraceBackend
traceBackend = TraceBackend
Bitmap
, maxTraceLength :: Maybe Int
maxTraceLength = Maybe Int
forall a. Maybe a
Nothing
, keepGoing :: Bool
keepGoing = Bool
False
, saveCounterexamples :: Maybe FilePath
saveCounterexamples = Maybe FilePath
forall a. Maybe a
Nothing
, chatty :: Bool
chatty = Bool
False
, debug :: DebugMode
debug = DebugMode
NoDebug
, tui :: Bool
tui = Bool
False
}
allow :: forall a. (Typeable a) => FragmentTypeFilter
allow :: forall a. Typeable a => FragmentTypeFilter
allow = Set TypeRep -> Set TypeRep -> FragmentTypeFilter
FragmentTypeFilter (TypeRep -> Set TypeRep
forall a. a -> Set a
Set.singleton (Proxy a -> TypeRep
forall {k} (proxy :: k -> *) (a :: k).
Typeable a =>
proxy a -> TypeRep
typeRep (forall t. Proxy t
forall {k} (t :: k). Proxy t
Proxy @a))) Set TypeRep
forall a. Monoid a => a
mempty
allow' :: forall a. (Typeable a) => Proxy a -> FragmentTypeFilter
allow' :: forall a. Typeable a => Proxy a -> FragmentTypeFilter
allow' Proxy a
_ = forall a. Typeable a => FragmentTypeFilter
allow @a
deny :: forall a. (Typeable a) => FragmentTypeFilter
deny :: forall a. Typeable a => FragmentTypeFilter
deny = Set TypeRep -> Set TypeRep -> FragmentTypeFilter
FragmentTypeFilter Set TypeRep
forall a. Monoid a => a
mempty (TypeRep -> Set TypeRep
forall a. a -> Set a
Set.singleton (Proxy a -> TypeRep
forall {k} (proxy :: k -> *) (a :: k).
Typeable a =>
proxy a -> TypeRep
typeRep (forall t. Proxy t
forall {k} (t :: k). Proxy t
Proxy @a)))
deny' :: forall a. (Typeable a) => Proxy a -> FragmentTypeFilter
deny' :: forall a. Typeable a => Proxy a -> FragmentTypeFilter
deny' Proxy a
_ = forall a. Typeable a => FragmentTypeFilter
deny @a
example :: forall a. (IsArgs a) => a -> Args
example :: forall a. IsArgs a => a -> Args
example = a -> Args
forall a. IsArgs a => a -> Args
Args
data LazyPruningMode
=
NoLazyPruning
|
LazyPruning EvaluationOrder
deriving (LazyPruningMode -> LazyPruningMode -> Bool
(LazyPruningMode -> LazyPruningMode -> Bool)
-> (LazyPruningMode -> LazyPruningMode -> Bool)
-> Eq LazyPruningMode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: LazyPruningMode -> LazyPruningMode -> Bool
== :: LazyPruningMode -> LazyPruningMode -> Bool
$c/= :: LazyPruningMode -> LazyPruningMode -> Bool
/= :: LazyPruningMode -> LazyPruningMode -> Bool
Eq, Int -> LazyPruningMode -> ShowS
[LazyPruningMode] -> ShowS
LazyPruningMode -> FilePath
(Int -> LazyPruningMode -> ShowS)
-> (LazyPruningMode -> FilePath)
-> ([LazyPruningMode] -> ShowS)
-> Show LazyPruningMode
forall a.
(Int -> a -> ShowS) -> (a -> FilePath) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> LazyPruningMode -> ShowS
showsPrec :: Int -> LazyPruningMode -> ShowS
$cshow :: LazyPruningMode -> FilePath
show :: LazyPruningMode -> FilePath
$cshowList :: [LazyPruningMode] -> ShowS
showList :: [LazyPruningMode] -> ShowS
Show)
data EvaluationOrder
=
Forward
|
Backward
deriving (EvaluationOrder -> EvaluationOrder -> Bool
(EvaluationOrder -> EvaluationOrder -> Bool)
-> (EvaluationOrder -> EvaluationOrder -> Bool)
-> Eq EvaluationOrder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EvaluationOrder -> EvaluationOrder -> Bool
== :: EvaluationOrder -> EvaluationOrder -> Bool
$c/= :: EvaluationOrder -> EvaluationOrder -> Bool
/= :: EvaluationOrder -> EvaluationOrder -> Bool
Eq, Int -> EvaluationOrder -> ShowS
[EvaluationOrder] -> ShowS
EvaluationOrder -> FilePath
(Int -> EvaluationOrder -> ShowS)
-> (EvaluationOrder -> FilePath)
-> ([EvaluationOrder] -> ShowS)
-> Show EvaluationOrder
forall a.
(Int -> a -> ShowS) -> (a -> FilePath) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> EvaluationOrder -> ShowS
showsPrec :: Int -> EvaluationOrder -> ShowS
$cshow :: EvaluationOrder -> FilePath
show :: EvaluationOrder -> FilePath
$cshowList :: [EvaluationOrder] -> ShowS
showList :: [EvaluationOrder] -> ShowS
Show)
data DebugMode
=
NoDebug
|
StopOnPassed
|
AlwaysStop
deriving (DebugMode -> DebugMode -> Bool
(DebugMode -> DebugMode -> Bool)
-> (DebugMode -> DebugMode -> Bool) -> Eq DebugMode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DebugMode -> DebugMode -> Bool
== :: DebugMode -> DebugMode -> Bool
$c/= :: DebugMode -> DebugMode -> Bool
/= :: DebugMode -> DebugMode -> Bool
Eq, Int -> DebugMode -> ShowS
[DebugMode] -> ShowS
DebugMode -> FilePath
(Int -> DebugMode -> ShowS)
-> (DebugMode -> FilePath)
-> ([DebugMode] -> ShowS)
-> Show DebugMode
forall a.
(Int -> a -> ShowS) -> (a -> FilePath) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DebugMode -> ShowS
showsPrec :: Int -> DebugMode -> ShowS
$cshow :: DebugMode -> FilePath
show :: DebugMode -> FilePath
$cshowList :: [DebugMode] -> ShowS
showList :: [DebugMode] -> ShowS
Show)