2012-12-06 15:30:28 -05:00
|
|
|
module Mutant
|
|
|
|
class Mutator
|
|
|
|
class Node
|
|
|
|
class Literal < self
|
|
|
|
# Abstract mutator for boolean literals
|
|
|
|
class Boolean < self
|
|
|
|
|
2013-06-10 03:19:31 -04:00
|
|
|
handle :true, :false
|
|
|
|
|
2012-12-06 15:30:28 -05:00
|
|
|
private
|
|
|
|
|
2013-06-10 03:19:31 -04:00
|
|
|
MAP = {
|
|
|
|
:true => :false,
|
|
|
|
:false => :true
|
|
|
|
}.freeze
|
|
|
|
|
2012-12-06 15:30:28 -05:00
|
|
|
# Emit mutants
|
|
|
|
#
|
|
|
|
# @return [undefined]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def dispatch
|
|
|
|
emit_nil
|
2013-06-10 03:19:31 -04:00
|
|
|
emit(s(MAP.fetch(node.type)))
|
2012-12-06 15:30:28 -05:00
|
|
|
end
|
2013-06-04 04:25:13 -04:00
|
|
|
|
|
|
|
end # Boolean
|
|
|
|
end # Literal
|
|
|
|
end # Node
|
|
|
|
end # Mutatork
|
|
|
|
end # Mutant
|