Safe Haskell | None |
---|---|
Language | Haskell2010 |
Show mutant variations
- class ShowMutable a where
- mutantSEq :: (Eq a, Show a) => a -> a -> MutantS
- showMutantAsTuple :: ShowMutable a => [String] -> a -> a -> String
- showMutantNested :: ShowMutable a => [String] -> a -> a -> String
- showMutantDefinition :: ShowMutable a => [String] -> a -> a -> String
- showMutantBindings :: ShowMutable a => [String] -> a -> a -> String
- data MutantS
- mutantSTuple :: [MutantS] -> MutantS
Documentation
class ShowMutable a where Source #
Types that can have their mutation shown.
Has only one function mutantS
that returns a simple AST (MutantS
)
representing the mutant. A standard implementation of mutantS
for Eq
types is given by mutantSEq
.
mutantSEq :: (Eq a, Show a) => a -> a -> MutantS Source #
For a given type Type
instance of Eq
and Show
,
define the ShowMutable
instance as:
instance ShowMutable Type where mutantS = mutantSEq
showMutantAsTuple :: ShowMutable a => [String] -> a -> a -> String Source #
Show a Mutant as a tuple of lambdas.
> putStrLn $ showMutantAsTuple ["p && q","not p"] ((&&),not) ((||),id) ( \p q -> case (p,q) of (False,False) -> True _ -> p && q , \p -> case p of False -> False True -> True _ -> not p )
Can be easily copy pasted into an interactive session for manipulation.
On GHCi, use :{
and :}
to allow multi-line expressions and definitions.
showMutantNested :: ShowMutable a => [String] -> a -> a -> String Source #
Show a Mutant as a tuple of nested lambdas.
Very similar to showMutantAsTuple
, but the underlying data structure is
not flatten: so the output is as close as possible to the underlying
representation.
showMutantDefinition :: ShowMutable a => [String] -> a -> a -> String Source #
Show a Mutant as a new complete top-level definition, with a prime appended to the name of the mutant.
> putStrLn $ showMutantDefinition ["p && q","not p"] ((&&),not) ((==),id) False &&- False = True p &&- q = p && q not' False = False not' True = True not' p = not p
showMutantBindings :: ShowMutable a => [String] -> a -> a -> String Source #
Show a Mutant as the list of bindings that differ from the original function(s).
> putStrLn $ showMutantBindings ["p && q","not p"] ((&&),not) ((==),id) False && False = True not False = False not True = True
Can possibly be copied into the source of the original function for manipulation.
(Show) Structure of a mutant. This format is intended for processing then pretty-printing.
mutantSTuple :: [MutantS] -> MutantS Source #