6b2e2a8bb0
* Remove some RBX only nodes * Register parser types * Remove all occurences of ::Rubinius when loading libraries
49 lines
997 B
Ruby
49 lines
997 B
Ruby
module Mutant
|
|
class Mutator
|
|
class Node
|
|
class Literal < self
|
|
# Mutator for float literals
|
|
class Float < self
|
|
|
|
handle(:float)
|
|
|
|
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 # Float
|
|
end # Literal
|
|
end # Node
|
|
end # Mutator
|
|
end # Mutant
|