Skip to content

Commit

Permalink
Remove useless binary left negation
Browse files Browse the repository at this point in the history
[Fix #1240]

* This orthogonal is not universal, especially in assignment cases.
  • Loading branch information
mbj committed Aug 29, 2021
1 parent 18f84be commit 7243e40
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
5 changes: 0 additions & 5 deletions lib/mutant/mutator/node/binary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ def dispatch
emit_singletons
emit_promotions
emit_operator_mutations
emit_left_negation
emit_left_mutations
emit_right_mutations
end
Expand All @@ -35,10 +34,6 @@ def emit_promotions
emit(right)
end

def emit_left_negation
emit(s(node.type, n_not(left), right))
end

end # Binary
end # Node
end # Mutator
Expand Down
1 change: 0 additions & 1 deletion meta/and.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@
mutation 'true or false'
mutation 'false and false'
mutation 'true and true'
mutation '!true and false'
end
14 changes: 13 additions & 1 deletion meta/or.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,17 @@
mutation 'false or false'
mutation 'true or true'
mutation 'true and false'
mutation '!true or false'
end

Mutant::Meta::Example.add :or do
source 'a = true or false'

singleton_mutations
mutation 'false'
mutation 'a = true'
mutation 'a = false or false'
mutation 'a = true or true'
mutation 'a = true and false'
mutation 'nil or false'
mutation 'a__mutant__ = true or false'
end

0 comments on commit 7243e40

Please sign in to comment.