free_mutant/lib/mutant/mutator/literal/float.rb
Markus Schirp 76199d082b Cleanup mutator internals
* Rename emit_safe to emit
* Rename emit_unsafe to emit!
2012-08-15 21:14:07 +02:00

46 lines
887 B
Ruby

module Mutant
class Mutator
class Literal < self
# Represent mutations on fixnum literal
class Float < self
handle(Rubinius::AST::FloatLiteral)
private
# Emit mutants
#
# @return [undefined]
#
def dispatch
emit_nil
emit_values(values)
emit_special_cases
emit_new { new_self(Random.float) }
end
# Emit special cases
#
# @return [undefined]
#
# @api private
#
def emit_special_cases
[infinity, negative_infinity, nan].each do |value|
emit(value)
end
end
# Return values to test against
#
# @return [Array]
#
# @api private
#
def values
[0.0, 1.0] << -node.value
end
end
end
end
end