From 7243e40e02097fbedf293b1159bf5850f4ca91ce Mon Sep 17 00:00:00 2001 From: Markus Schirp Date: Sun, 29 Aug 2021 20:20:35 +0000 Subject: [PATCH] Remove useless binary left negation [Fix #1240] * This orthogonal is not universal, especially in assignment cases. --- lib/mutant/mutator/node/binary.rb | 5 ----- meta/and.rb | 1 - meta/or.rb | 14 +++++++++++++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/mutant/mutator/node/binary.rb b/lib/mutant/mutator/node/binary.rb index 3e2492bbf..202daaa58 100644 --- a/lib/mutant/mutator/node/binary.rb +++ b/lib/mutant/mutator/node/binary.rb @@ -21,7 +21,6 @@ def dispatch emit_singletons emit_promotions emit_operator_mutations - emit_left_negation emit_left_mutations emit_right_mutations end @@ -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 diff --git a/meta/and.rb b/meta/and.rb index 1c1ac7103..e6ea8fe19 100644 --- a/meta/and.rb +++ b/meta/and.rb @@ -9,5 +9,4 @@ mutation 'true or false' mutation 'false and false' mutation 'true and true' - mutation '!true and false' end diff --git a/meta/or.rb b/meta/or.rb index 133777847..6827541b7 100644 --- a/meta/or.rb +++ b/meta/or.rb @@ -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