Change connective mutator to mutate the operand boolean context
This commit is contained in:
parent
62d9e30570
commit
23251a25d0
3 changed files with 9 additions and 17 deletions
|
@ -1,3 +1,3 @@
|
||||||
---
|
---
|
||||||
threshold: 16
|
threshold: 16
|
||||||
total_score: 743
|
total_score: 737
|
||||||
|
|
|
@ -28,7 +28,7 @@ module Mutant
|
||||||
emit(left)
|
emit(left)
|
||||||
emit(right)
|
emit(right)
|
||||||
mutate_operator
|
mutate_operator
|
||||||
mutate_conditions
|
mutate_operands
|
||||||
end
|
end
|
||||||
|
|
||||||
# Emit operator mutations
|
# Emit operator mutations
|
||||||
|
@ -47,11 +47,9 @@ module Mutant
|
||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
#
|
#
|
||||||
def mutate_conditions
|
def mutate_operands
|
||||||
[N_TRUE, N_FALSE, N_NIL].each do |condition|
|
emit(s(node.type, s(:not, left), right))
|
||||||
emit_left(condition) unless left == condition
|
emit(s(node.type, left, s(:not, right)))
|
||||||
emit_right(condition) unless right == condition
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end # Binary
|
end # Binary
|
||||||
|
|
|
@ -12,11 +12,8 @@ describe Mutant::Mutator::Node::Connective::Binary, 'mutations' do
|
||||||
|
|
||||||
mutations << 'true or false'
|
mutations << 'true or false'
|
||||||
|
|
||||||
mutations << 'false and false'
|
mutations << 'not true and false'
|
||||||
mutations << 'true and true'
|
mutations << 'true and not false'
|
||||||
|
|
||||||
mutations << 'nil and false'
|
|
||||||
mutations << 'true and nil'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it_should_behave_like 'a mutator'
|
it_should_behave_like 'a mutator'
|
||||||
|
@ -33,11 +30,8 @@ describe Mutant::Mutator::Node::Connective::Binary, 'mutations' do
|
||||||
|
|
||||||
mutations << 'true and false'
|
mutations << 'true and false'
|
||||||
|
|
||||||
mutations << 'false or false'
|
mutations << 'not true or false'
|
||||||
mutations << 'true or true'
|
mutations << 'true or not false'
|
||||||
|
|
||||||
mutations << 'nil or false'
|
|
||||||
mutations << 'true or nil'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it_should_behave_like 'a mutator'
|
it_should_behave_like 'a mutator'
|
||||||
|
|
Loading…
Add table
Reference in a new issue