Sha256: 5d91e72f191fd38725348276807b7279c3b160cb57ee81533270afcefd2f5bcc

Contents?: true

Size: 973 Bytes

Versions: 18

Compression:

Stored size: 973 Bytes

Contents

module Mutant
  class Mutator
    class Node
      class Literal < self
        # Mutator for float literals
        class Float < self

          handle(Rubinius::AST::FloatLiteral)

        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
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
mutant-0.2.20 lib/mutant/mutator/node/literal/float.rb
mutant-0.2.17 lib/mutant/mutator/node/literal/float.rb
mutant-0.2.16 lib/mutant/mutator/node/literal/float.rb
mutant-0.2.15 lib/mutant/mutator/node/literal/float.rb
mutant-0.2.14 lib/mutant/mutator/node/literal/float.rb
mutant-0.2.13 lib/mutant/mutator/node/literal/float.rb
mutant-0.2.12 lib/mutant/mutator/node/literal/float.rb
mutant-0.2.11 lib/mutant/mutator/node/literal/float.rb
mutant-0.2.9 lib/mutant/mutator/node/literal/float.rb
mutant-0.2.8 lib/mutant/mutator/node/literal/float.rb
mutant-0.2.7 lib/mutant/mutator/node/literal/float.rb
mutant-0.2.6 lib/mutant/mutator/node/literal/float.rb
mutant-0.2.5 lib/mutant/mutator/node/literal/float.rb
mutant-0.2.4 lib/mutant/mutator/node/literal/float.rb
mutant-0.2.3 lib/mutant/mutator/node/literal/float.rb
mutant-0.2.2 lib/mutant/mutator/node/literal/float.rb
mutant-0.2.1 lib/mutant/mutator/node/literal/float.rb
mutant-0.2.0 lib/mutant/mutator/node/literal/float.rb