
* Do not follow rubinius names anymore. An explict declaration now declares a mutator handles specific AST node. * Has a nice impact on metrics.
35 lines
648 B
Ruby
35 lines
648 B
Ruby
module Mutant
|
|
class Mutator
|
|
class Literal < Mutator
|
|
# Represent mutations on fixnum literal
|
|
class Fixnum < Literal
|
|
|
|
handle(Rubinius::AST::FixnumLiteral)
|
|
|
|
private
|
|
|
|
# Emit mutants
|
|
#
|
|
# @return [undefined]
|
|
#
|
|
# @api private
|
|
#
|
|
def dispatch
|
|
emit_nil
|
|
emit_values(values)
|
|
emit_new { new_self(Mutant.random_fixnum) }
|
|
end
|
|
|
|
# Return values to mutate against
|
|
#
|
|
# @return [Array]
|
|
#
|
|
# @api private
|
|
#
|
|
def values
|
|
[0, 1, -node.value]
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|