2013-07-28 19:03:06 -04:00
|
|
|
# encoding: utf-8
|
|
|
|
|
2012-12-06 15:30:28 -05:00
|
|
|
module Mutant
|
|
|
|
class Mutator
|
|
|
|
class Node
|
|
|
|
class Literal < self
|
|
|
|
# Mutator for fixnum literals
|
|
|
|
class Fixnum < self
|
|
|
|
|
2013-06-04 04:25:13 -04:00
|
|
|
handle(:int)
|
2012-12-06 15:30:28 -05:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
# Emit mutants
|
|
|
|
#
|
|
|
|
# @return [undefined]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def dispatch
|
2014-06-05 12:37:31 -04:00
|
|
|
emit_singletons
|
2012-12-06 15:30:28 -05:00
|
|
|
emit_values(values)
|
|
|
|
end
|
|
|
|
|
|
|
|
# Return values to mutate against
|
|
|
|
#
|
|
|
|
# @return [Array]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def values
|
2013-07-27 15:14:41 -04:00
|
|
|
[0, 1, -value, value + 1, value - 1]
|
2012-12-06 15:30:28 -05:00
|
|
|
end
|
2013-06-04 04:25:13 -04:00
|
|
|
|
2013-06-15 11:16:34 -04:00
|
|
|
# Return value
|
|
|
|
#
|
|
|
|
# @return [Object]
|
|
|
|
#
|
|
|
|
# @api private
|
|
|
|
#
|
|
|
|
def value
|
|
|
|
children.first
|
|
|
|
end
|
|
|
|
|
2013-06-04 04:25:13 -04:00
|
|
|
end # Fixnuma
|
|
|
|
end # Literal
|
|
|
|
end # Node
|
|
|
|
end # Mutator
|
|
|
|
end # Mutant
|