Sha256: 381d055bc15c3a71a2a2f6dbd2419856f4e5da49083c3225d5f56561805e88da

Contents?: true

Size: 918 Bytes

Versions: 6

Compression:

Stored size: 918 Bytes

Contents

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

6 entries across 6 versions & 1 rubygems

Version Path
mutant-0.8.16 lib/mutant/mutator/node/literal/float.rb
mutant-0.8.15 lib/mutant/mutator/node/literal/float.rb
mutant-0.8.14 lib/mutant/mutator/node/literal/float.rb
mutant-0.8.13 lib/mutant/mutator/node/literal/float.rb
mutant-0.8.12 lib/mutant/mutator/node/literal/float.rb
mutant-0.8.11 lib/mutant/mutator/node/literal/float.rb