Hardcode AST like parser would produce it

This commit is contained in:
Markus Schirp 2013-07-28 18:46:29 +02:00
parent a4b9e6d04a
commit efd6a52f16
2 changed files with 9 additions and 9 deletions

View file

@ -15,9 +15,9 @@ module Mutant
end
module_function :s
NAN = s(:send, s(:float, 0.0), :/, s(:args, s(:float, 0.0)))
NEGATIVE_INFINITY = s(:send, s(:float, -1.0), :/, s(:args, s(:float, 0.0)))
INFINITY = s(:send, s(:float, 1.0), :/, s(:args, s(:float, 0.0)))
NAN = s(:begin, s(:send, s(:float, 0.0), :/, s(:args, s(:float, 0.0))))
NEGATIVE_INFINITY = s(:begin, s(:send, s(:float, -1.0), :/, s(:args, s(:float, 0.0))))
INFINITY = s(:begin, s(:send, s(:float, 1.0), :/, s(:args, s(:float, 0.0))))
NEW_OBJECT = s(:send, s(:const, s(:cbase), :Object), :new)
RAISE = s(:send, nil, :raise)

View file

@ -8,10 +8,10 @@ describe Mutant::Mutator::Node::Literal, 'range' do
mutations = []
mutations << 'nil'
mutations << '1...100'
mutations << '(0.0/0.0)..100'
mutations << '(0.0 / 0.0)..100'
#mutations << [:dot2, [:negate, [:call, [:lit, 1.0], :/, [:arglist, [:lit, 0.0]]]], [:lit, 100]]
mutations << '1..(1.0/0.0)'
mutations << '1..(0.0/0.0)'
mutations << '1..(1.0 / 0.0)'
mutations << '1..(0.0 / 0.0)'
end
it_should_behave_like 'a mutator'
@ -24,10 +24,10 @@ describe Mutant::Mutator::Node::Literal, 'range' do
mutations = []
mutations << 'nil'
mutations << '1..100'
mutations << '(0.0/0.0)...100'
mutations << '(0.0 / 0.0)...100'
#mutations << [:dot3, [:negate, [:call, [:lit, 1.0], :/, [:arglist, [:lit, 0.0]]]], [:lit, 100]]
mutations << '1...(1.0/0.0)'
mutations << '1...(0.0/0.0)'
mutations << '1...(1.0 / 0.0)'
mutations << '1...(0.0 / 0.0)'
end
it_should_behave_like 'a mutator'