free_mutant/lib/mutant/mutator/literal.rb
Markus Schirp 3de69d832d Add cli stuff
* Currently broken (sorry) but do have to push to fix some nasty
  transitive dependency stuff (do not ask).
* Fix fix it tomorrow (hopefully I find the time)
2012-09-11 01:01:06 +02:00

52 lines
1,020 B
Ruby

module Mutant
class Mutator
# Abstract mutator for literal AST nodes
class Literal < self
include AbstractClass
private
# Return new float literal
#
# @param [#to_f] value
#
# @return [Rubinius::Node::FloatLiteral]
#
# @api private
#
def new_float(value)
new(Rubinius::AST::FloatLiteral, value)
end
# Return AST representing NaN
#
# @return [Rubinius::Node::AST]
#
# @api private
#
def nan
new_send(new_float(0), :/, new_float(0))
end
# Return AST representing negative infinity
#
# @return [Rubinius::Node::AST]
#
# @api private
#
def negative_infinity
new(Rubinius::AST::Negate, infinity)
end
# Return AST representing infinity
#
# @return [Rubinius::Node::AST]
#
# @api private
#
def infinity
new_send(new_float(1), :/, new_float(0))
end
end
end
end