Sha256: 83e2069fee11594ecb07bd7e22d0d8aeb353d3a81e748b9ecdbcf24c298b3f1d

Contents?: true

Size: 949 Bytes

Versions: 17

Compression:

Stored size: 949 Bytes

Contents

# frozen_string_literal: true

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

          handle(:float)

        private

          # Emit mutations
          #
          # @return [undefined]
          def dispatch
            emit_singletons
            emit_values
            emit_special_cases
          end

          SPECIAL = [
            N_NAN,
            N_NEGATIVE_INFINITY,
            N_INFINITY
          ].freeze

          # Emit special cases
          #
          # @return [undefined]
          def emit_special_cases
            SPECIAL.each(&method(:emit))
          end

          # Values to mutate to
          #
          # @return [Array]
          def values
            original = children.first

            [0.0, 1.0, -original]
          end

        end # Float
      end # Literal
    end # Node
  end # Mutator
end # Mutant

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
mutant-0.9.8 lib/mutant/mutator/node/literal/float.rb
mutant-0.9.7 lib/mutant/mutator/node/literal/float.rb
mutant-0.9.6 lib/mutant/mutator/node/literal/float.rb
mutant-0.9.5 lib/mutant/mutator/node/literal/float.rb
mutant-0.9.4 lib/mutant/mutator/node/literal/float.rb
mutant-0.9.3 lib/mutant/mutator/node/literal/float.rb
mutant-0.9.2 lib/mutant/mutator/node/literal/float.rb
mutant-0.9.1 lib/mutant/mutator/node/literal/float.rb
mutant-0.9.0 lib/mutant/mutator/node/literal/float.rb
mutant-0.8.24 lib/mutant/mutator/node/literal/float.rb
mutant-0.8.23 lib/mutant/mutator/node/literal/float.rb
mutant-0.8.22 lib/mutant/mutator/node/literal/float.rb
mutant-0.8.21 lib/mutant/mutator/node/literal/float.rb
mutant-0.8.20 lib/mutant/mutator/node/literal/float.rb
mutant-0.8.19 lib/mutant/mutator/node/literal/float.rb
mutant-0.8.18 lib/mutant/mutator/node/literal/float.rb
mutant-0.8.17 lib/mutant/mutator/node/literal/float.rb