free_mutant/lib/mutant/mutator/literal/fixnum.rb
2012-08-09 23:07:22 +02:00

35 lines
635 B
Ruby

module Mutant
class Mutator
class Literal < self
# Represent mutations on fixnum literal
class Fixnum < self
handle(Rubinius::AST::FixnumLiteral)
private
# Emit mutants
#
# @return [undefined]
#
# @api private
#
def dispatch
emit_nil
emit_values(values)
emit_new { new_self(Random.fixnum) }
end
# Return values to mutate against
#
# @return [Array]
#
# @api private
#
def values
[0, 1, -node.value]
end
end
end
end
end