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
|
||||
total_score: 743
|
||||
total_score: 737
|
||||
|
|
|
@ -28,7 +28,7 @@ module Mutant
|
|||
emit(left)
|
||||
emit(right)
|
||||
mutate_operator
|
||||
mutate_conditions
|
||||
mutate_operands
|
||||
end
|
||||
|
||||
# Emit operator mutations
|
||||
|
@ -47,11 +47,9 @@ module Mutant
|
|||
#
|
||||
# @api private
|
||||
#
|
||||
def mutate_conditions
|
||||
[N_TRUE, N_FALSE, N_NIL].each do |condition|
|
||||
emit_left(condition) unless left == condition
|
||||
emit_right(condition) unless right == condition
|
||||
end
|
||||
def mutate_operands
|
||||
emit(s(node.type, s(:not, left), right))
|
||||
emit(s(node.type, left, s(:not, right)))
|
||||
end
|
||||
|
||||
end # Binary
|
||||
|
|
|
@ -12,11 +12,8 @@ describe Mutant::Mutator::Node::Connective::Binary, 'mutations' do
|
|||
|
||||
mutations << 'true or false'
|
||||
|
||||
mutations << 'false and false'
|
||||
mutations << 'true and true'
|
||||
|
||||
mutations << 'nil and false'
|
||||
mutations << 'true and nil'
|
||||
mutations << 'not true and false'
|
||||
mutations << 'true and not false'
|
||||
end
|
||||
|
||||
it_should_behave_like 'a mutator'
|
||||
|
@ -33,11 +30,8 @@ describe Mutant::Mutator::Node::Connective::Binary, 'mutations' do
|
|||
|
||||
mutations << 'true and false'
|
||||
|
||||
mutations << 'false or false'
|
||||
mutations << 'true or true'
|
||||
|
||||
mutations << 'nil or false'
|
||||
mutations << 'true or nil'
|
||||
mutations << 'not true or false'
|
||||
mutations << 'true or not false'
|
||||
end
|
||||
|
||||
it_should_behave_like 'a mutator'
|
||||
|
|
Loading…
Add table
Reference in a new issue