![Markus Schirp](/assets/img/avatar_default.png)
* Do not follow rubinius names anymore. An explict declaration now declares a mutator handles specific AST node. * Has a nice impact on metrics.
36 lines
710 B
Ruby
36 lines
710 B
Ruby
module Mutant
|
|
class Mutator
|
|
class Literal < Mutator
|
|
# Represent mutations on fixnum literal
|
|
class Float < Literal
|
|
|
|
handle(Rubinius::AST::FloatLiteral)
|
|
|
|
private
|
|
|
|
# Emit mutants
|
|
#
|
|
# @return [undefined]
|
|
#
|
|
def dispatch
|
|
emit_nil
|
|
emit_values(values)
|
|
emit_safe(infinity)
|
|
emit_safe(negative_infinity)
|
|
emit_safe(nan)
|
|
emit_new { new_self(Mutant.random_float) }
|
|
end
|
|
|
|
# Return values to test against
|
|
#
|
|
# @return [Array]
|
|
#
|
|
# @api private
|
|
#
|
|
def values
|
|
[0.0, 1.0] << -node.value
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|