Sha256: 5555cd4a034fc8aa45ed91daaa30dada6bfec28afdfbe6f283c8c95320bf5b3c

Contents?: true

Size: 1.42 KB

Versions: 21

Compression:

Stored size: 1.42 KB

Contents

module Mutant
  class Mutator
    class Node
      class Literal

        # Abstract literal range mutator
        class Range < self

          MAP = {
            irange: :erange,
            erange: :irange
          }.freeze

          children :start, :_end

          handle(*MAP.keys)

        private

          # Emit mutants
          #
          # @return [undefined]
          #
          # @api private
          #
          def dispatch
            emit_singletons
            emit_inverse
            emit_lower_bound_mutations
            emit_upper_bound_mutations
          end

          # Return inverse node
          #
          # @return [Parser::AST::Node]
          #
          # @api private
          #
          def emit_inverse
            emit(s(MAP.fetch(node.type), *children))
          end

          # Emit range start mutations
          #
          # @return [undefined]
          #
          # @api private
          #
          def emit_upper_bound_mutations
            emit__end_mutations
            emit_type(N_NAN, _end)
          end

          # Emit start mutations
          #
          # @return [undefined]
          #
          # @api private
          #
          def emit_lower_bound_mutations
            emit_start_mutations
            emit_type(start, N_INFINITY)
            emit_type(start, N_NAN)
          end

        end # Range
      end # Literal
    end # Node
  end # Mutator
end # Mutant

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
mutant-0.8.0 lib/mutant/mutator/node/literal/range.rb
mutant-0.7.9 lib/mutant/mutator/node/literal/range.rb
mutant-0.7.8 lib/mutant/mutator/node/literal/range.rb
mutant-0.7.7 lib/mutant/mutator/node/literal/range.rb
mutant-0.7.6 lib/mutant/mutator/node/literal/range.rb
mutant-0.7.5 lib/mutant/mutator/node/literal/range.rb
mutant-0.7.4 lib/mutant/mutator/node/literal/range.rb
mutant-0.7.3 lib/mutant/mutator/node/literal/range.rb
mutant-0.7.2 lib/mutant/mutator/node/literal/range.rb
mutant-0.7.1 lib/mutant/mutator/node/literal/range.rb
mutant-0.6.7 lib/mutant/mutator/node/literal/range.rb
mutant-0.6.6 lib/mutant/mutator/node/literal/range.rb
mutant-0.6.5 lib/mutant/mutator/node/literal/range.rb
mutant-0.6.4 lib/mutant/mutator/node/literal/range.rb
mutant-0.6.3 lib/mutant/mutator/node/literal/range.rb
mutant-0.6.2 lib/mutant/mutator/node/literal/range.rb
mutant-0.6.0 lib/mutant/mutator/node/literal/range.rb
mutant-0.5.26 lib/mutant/mutator/node/literal/range.rb
mutant-0.5.25 lib/mutant/mutator/node/literal/range.rb
mutant-0.5.24 lib/mutant/mutator/node/literal/range.rb