2013-07-28 19:03:06 -04:00
|
|
|
# encoding: utf-8
|
|
|
|
|
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
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2013-06-10 03:19:31 -04:00
|
|
|
MAP = {
|
2013-09-07 14:27:06 -04:00
|
|
|
true: :false,
|
|
|
|
false: :true
|
2013-06-10 03:19:31 -04:00
|
|
|
}.freeze
|
|
|
|
|
2013-06-21 12:00:17 -04:00
|
|
|
handle(*MAP.keys)
|
|
|
|
|
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
|