Remove Inf & NaN mutations for ranges

- Removes NaN ranges. NaN..N and N..NaN are never valid ranges so it seemed prudent to keep
  them from being emitted.
- Removes Inf as a range boundary mutation. The infinite case should be covered incrementally by the +1/-1
  mutations.
- Closes #392
This commit is contained in:
Daniel Gollahon 2016-07-24 21:43:46 -07:00
parent 96af0db2a3
commit 63042bd67e
3 changed files with 1 additions and 36 deletions

View file

@ -11,7 +11,7 @@ module Mutant
erange: :irange
}.freeze
children :start, :_end
children :lower_bound, :upper_bound
handle(*MAP.keys)
@ -34,23 +34,6 @@ module Mutant
emit(s(MAP.fetch(node.type), *children))
end
# Emit range start mutations
#
# @return [undefined]
def emit_upper_bound_mutations
emit__end_mutations
emit_type(N_NAN, _end)
end
# Emit start mutations
#
# @return [undefined]
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

View file

@ -3,9 +3,6 @@ Mutant::Meta::Example.add :irange do
singleton_mutations
mutation '1...100'
mutation '(0.0 / 0.0)..100'
mutation '1..(1.0 / 0.0)'
mutation '1..(0.0 / 0.0)'
mutation '-1..100'
mutation '0..100'
mutation '2..100'
@ -25,9 +22,6 @@ Mutant::Meta::Example.add :erange do
singleton_mutations
mutation '1..100'
mutation '(0.0 / 0.0)...100'
mutation '1...(1.0 / 0.0)'
mutation '1...(0.0 / 0.0)'
mutation '-1...100'
mutation '0...100'
mutation '2...100'

View file

@ -509,14 +509,11 @@ Mutant::Meta::Example.add :send do
mutation 'foo(n...-1)'
mutation 'foo(nil..-1)'
mutation 'foo(self..-1)'
mutation 'foo(n..(1.0 / 0.0))'
mutation 'foo(n..(0.0 / 0.0))'
mutation 'foo(n..nil)'
mutation 'foo(n..self)'
mutation 'foo(n..0)'
mutation 'foo(n..1)'
mutation 'foo(n..-2)'
mutation 'foo((0.0 / 0.0)..-1)'
end
Mutant::Meta::Example.add :send do
@ -542,9 +539,6 @@ Mutant::Meta::Example.add :send do
mutation 'foo[n...-2]'
mutation 'foo[nil..-2]'
mutation 'foo[self..-2]'
mutation 'foo[n..(1.0 / 0.0)]'
mutation 'foo[n..(0.0 / 0.0)]'
mutation 'foo[(0.0 / 0.0)..-2]'
end
Mutant::Meta::Example.add :send do
@ -568,9 +562,6 @@ Mutant::Meta::Example.add :send do
mutation 'foo[n...-2]'
mutation 'foo[nil...-1]'
mutation 'foo[self...-1]'
mutation 'foo[n...(1.0 / 0.0)]'
mutation 'foo[n...(0.0 / 0.0)]'
mutation 'foo[(0.0 / 0.0)...-1]'
end
Mutant::Meta::Example.add :send do
@ -594,9 +585,6 @@ Mutant::Meta::Example.add :send do
mutation 'foo[n...-1]'
mutation 'foo[nil..-1]'
mutation 'foo[self..-1]'
mutation 'foo[n..(1.0 / 0.0)]'
mutation 'foo[n..(0.0 / 0.0)]'
mutation 'foo[(0.0 / 0.0)..-1]'
mutation 'foo.drop(n)'
end