Permalink
Switch branches/tags
Nothing to show
Find file Copy path
184 lines (138 sloc) 3.89 KB

Supported mutators

Stryker supports a variety of mutators, which are listed below.

Support

Mutator Stryker Stryker.NET Stryker4s
Binary Operators ℹ️¹
Boolean Substitutions ℹ️²
Logical operators
Unary operators
Update operators n/a
Remove conditionals
Assignment mutator n/a
Array declarator
String mutator
Block statement
Checked mutator n/a n/a
Method mutator n/a
  • ¹: Stryker4s does not support (+,-,*,/ and % operators)
  • ²: Stryker4s does not support boolean substitutions with !

Binary operators

Original Mutated
a + b a - b
a - b a + b
a * b a / b
a / b a * b
a % b a * b
a < b a <= b
a < b a >= b
a <= b a < b
a <= b a > b
a > b a >= b
a > b a <= b
a >= b a > b
a >= b a < b
a == b a != b
a != b a == b
a === b a !== b
a !== b a === b

🔝 Back to Top

Boolean Substitutions

Original Mutated
true false
false true
!

🔝 Back to Top

Logical operators

Original Mutated
a && b a || b
a || b a && b

🔝 Back to Top

Unary operators

Original Mutated
+a -a
-a +a

🔝 Back to Top

Update operators

Original Mutated
a++ a--
a-- a++
++a --a
--a ++a

🔝 Back to Top

Remove conditionals

Original Mutated
for (var i = 0; i < 10; i++) { } for (var i = 0; false; i++) { }
while (a > b) { } while (false) { }
do { } while (a > b); do { } while (false);
if (a > b) { } if (true) { }
if (a > b) { } if (false) { }
var x = a > b ? 1 : 2; var x = true ? 1 : 2;
var x = a > b ? 1 : 2; var x = false ? 1 : 2;

🔝 Back to Top

Assignment mutator

Original Mutated
+= -=
-= +=
*= /=
/= *=
%= *=
<<= >>=
>>= <<=
&= |=
|= &=

🔝 Back to Top

Array Declarator

Original Mutated
new Array(1, 2, 3, 4) new Array()
[1, 2, 3, 4] [ ]

🔝 Back to Top

String mutator

Original Mutated
"foo" (non-empty string) "" (empty string)
"" (empty string) "Stryker was here!"
s"foo ${bar}" (string interpolation) s"" ¹

¹ Only works with string interpolation and not others (like Scalameta quasiquotes) to avoid compile errors

🔝 Back to Top

Block statement

This mutator removes the content of every block statement. For example the code:

function saySomething() {
  console.log('Hello world!');
}

becomes:

function saySomething() {
}

🔝 Back to Top

Checked mutator

Stryker.NET specific mutator

Original Mutated
checked(2 + 4) 2 + 4

🔝 Back to Top

Method mutator

Original Mutated
a.filter(b) a.filterNot(b)
a.filterNot(b) a.filter(b)
a.exists(b) a.forAll(b)
a.forAll(b) a.exists(b)
a.isEmpty a.nonEmpty
a.nonEmpty a.isEmpty
a.indexOf a.lastIndexOf(b)
a.lastIndexOf(b) a.indexOf(b)
a.max a.min
a.min a.max

🔝 Back to Top