Mutate float literals also to negative infinity

* Also fixes invalid naming of support methods in literal float mutator.
This commit is contained in:
Markus Schirp 2012-07-29 18:08:29 +02:00
parent a3b9419494
commit 27f43eef35
2 changed files with 26 additions and 13 deletions

View file

@ -16,21 +16,10 @@ module Mutant
generator << new_self(-node.value)
generator << new_self(Mutant.random_float)
generator << infinity
generator << neg_infinity
generator << nan
end
# Return AST representing infinity
#
# @return [Rubinius::Node::AST]
#
# @api private
#
def infinity
'0.0/0.0'.to_ast.tap do |call|
call.line = node.line
end
end
# Return AST representing NaN
#
# @return [Rubinius::Node::AST]
@ -38,10 +27,34 @@ module Mutant
# @api private
#
def nan
'0.0/0.0'.to_ast.tap do |call|
call.line = node.line
end
end
# Return AST representing infinity
#
# @return [Rubinius::Node::AST]
#
# @api private
#
def infinity
'1.0/0.0'.to_ast.tap do |call|
call.line = node.line
end
end
# Return AST representing negative Infinity
#
# @return [Rubinius::Node::AST]
#
# @api private
#
def neg_infinity
'-1.0/0.0'.to_ast.tap do |call|
call.line = node.line
end
end
end
end
end