2012-07-31 19:45:46 +02:00
|
|
|
module Mutant
|
|
|
|
class Mutator
|
2012-08-09 23:07:22 +02:00
|
|
|
class Literal < self
|
2012-07-31 19:45:46 +02:00
|
|
|
# Abstract mutator for boolean literals
|
2012-08-09 23:07:22 +02:00
|
|
|
class Boolean < self
|
2012-07-31 19:45:46 +02:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
# Emit mutants
|
|
|
|
#
|
|
|
|
# @return [undefined]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def dispatch
|
|
|
|
emit_nil
|
|
|
|
emit_safe(inverse)
|
|
|
|
end
|
|
|
|
|
|
|
|
# Return inverse
|
|
|
|
#
|
|
|
|
# @return [Rubinius::AST::Node]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
2012-08-03 01:38:35 +02:00
|
|
|
def inverse
|
|
|
|
new(self.class::INVERSE_CLASS)
|
|
|
|
end
|
2012-07-31 19:45:46 +02:00
|
|
|
|
|
|
|
# Represent mutations of true literal
|
2012-08-09 23:07:22 +02:00
|
|
|
class TrueLiteral < self
|
2012-08-03 01:38:35 +02:00
|
|
|
INVERSE_CLASS = Rubinius::AST::FalseLiteral
|
2012-07-31 19:45:46 +02:00
|
|
|
|
|
|
|
handle(Rubinius::AST::TrueLiteral)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# Represent mutations of false literal
|
2012-08-09 23:07:22 +02:00
|
|
|
class FalseLiteral < self
|
2012-08-03 01:38:35 +02:00
|
|
|
INVERSE_CLASS = Rubinius::AST::TrueLiteral
|
2012-07-31 19:45:46 +02:00
|
|
|
|
|
|
|
handle(Rubinius::AST::FalseLiteral)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|