Sha256: 189c11a0b1ce774e272b28eff9436a120e3c38c44729c24d1ed3ca00d0faed9e

Contents?: true

Size: 918 Bytes

Versions: 8

Compression:

Stored size: 918 Bytes

Contents

module Mutest
  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 # Mutest

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mutest-0.0.9 lib/mutest/mutator/node/literal/float.rb
mutest-0.0.8 lib/mutest/mutator/node/literal/float.rb
mutest-0.0.7 lib/mutest/mutator/node/literal/float.rb
mutest-0.0.6 lib/mutest/mutator/node/literal/float.rb
mutest-0.0.5 lib/mutest/mutator/node/literal/float.rb
mutest-0.0.4 lib/mutest/mutator/node/literal/float.rb
mutest-0.0.3 lib/mutest/mutator/node/literal/float.rb
mutest-0.0.2 lib/mutest/mutator/node/literal/float.rb