class Mutest::Mutator::Node::Binary
Mutation
emitter to handle binary connectives
Constants
- INVERSE
Private Instance Methods
dispatch()
click to toggle source
Emit mutations
@return [undefined]
# File lib/mutest/mutator/node/binary.rb, line 20 def dispatch emit_singletons emit_promotions emit_operator_mutations emit_left_negation emit_left_mutations emit_right_mutations end
emit_left_negation()
click to toggle source
Emit left negation
We do not emit right negation as the `and` and `or` nodes in ruby are also used for control flow.
Irrespective of their syntax, aka `||` parses internally to `or`.
`do_a or do_b`. Negating left makes sense, negating right only when the result is actually used.
It would be possible to emit the right negation in case the use of the result is proved. Like parent is an assignment to an {l,i}var. Dunno if we ever get the time to do that.
@return [undefined]
# File lib/mutest/mutator/node/binary.rb, line 58 def emit_left_negation emit(s(node.type, n_not(left), right)) end
emit_operator_mutations()
click to toggle source
Emit operator mutations
@return [undefined]
# File lib/mutest/mutator/node/binary.rb, line 32 def emit_operator_mutations emit(s(INVERSE.fetch(node.type), left, right)) end
emit_promotions()
click to toggle source
Emit promotions
@return [undefined]
# File lib/mutest/mutator/node/binary.rb, line 39 def emit_promotions emit(left) emit(right) end