Skip to content

Operators

DurieuxPol edited this page Apr 12, 2024 · 7 revisions

Operators are objects that describe a type of mutation. They're like a guideline on how to perform the mutation they correspond to. There are two ways to tell the analysis which operators you want to use:

  • MTAbstractMutantOperator contents that returns all operators minus a few ones that are implemented a bit differently that the others
  • MTAbstractMutantOperator contentsAll that returns the whole set of operators and that is used by default for analysis

There are a lot of operators, so we won't describe them in detail, but here is an array summarising all operators:

Category Operators
Deletion Empty method | Remove ^ | Remove exception handler | Remove inject:into: | Remove not | Remove second block argument for detect:ifNone:
Arithmetic replacement Replace * by / | Replace / with * | Replace + with - | Replace - with +
Literal manipulation Negate boolean | Increase integer | Decrease integer | Integer to 0 | String replacement | Empty string
Logical boolean operation Replace and: receiver with true | Replace or: receiver with false | Replace and: argument with true | Replace or: argument with false | Replace obj and: block with false | Replace obj or: block with true | Replace and: with ==/nand:/or: | Replace or: with xor:/and:
Conditional boolean operation Replace ifTrue: receiver with true/false | Replace ifFalse: receiver with true/false | Replace ifTrue:ifFalse: receiver with true/false | Replace ifFalse:ifTrue: receiver with true/false | Replace whileTrue: receiver with true/false | Replace whileFalse: receiver with true/false | Replace ifTrue:/ifFalse: with ifFalse:/ifTrue: | Replace whileTrue:/whileFalse: with whileFalse:/whileTrue:
Relational operation Replace =/~= with ~=/= | Replace (a == b) with (a == b) not | Replace </> with >/< | Replace >= with =/> | Replace <= with =/</>/true | Replace max:/min: with min:/max:
Collection operation Replace isEmpty with notEmpty | Replace block argument for sortBlock: with always true block | Replace block argument for reject: with always true/always false block | Replace block argument for select: with always true/always false block | Replace select:/reject: with reject:/select: | Remove at:ifAbsent: | Remove block argument for do: | Replace first block argument for detect:ifNone: with always true/always false block | Replace second block argument for detect:ifNone: with empty block
Message sender Replace first/second/third argument of message send with nil | Replace message send with yourself
Other Replace assignment value with nil | Replace class reference by references to its subclasses