All Stryker versions support a variety of different mutators. We've aligned on a standard naming scheme so it is easy to switch and compare implementations. The difference in support is listed below.
Support#
Arithmetic Operator#
Original | Mutated |
---|
a + b | a - b |
a - b | a + b |
a * b | a / b |
a / b | a * b |
a % b | a * b |
๐ Back to Top
Array Declaration#
Original | Mutated |
---|
new Array(1, 2, 3, 4) | new Array() |
[1, 2, 3, 4] | [ ] |
๐ Back to Top
Assignment Expression#
Original | Mutated |
---|
+= | -= |
-= | += |
*= | /= |
/= | *= |
%= | *= |
<<= | >>= |
>>= | <<= |
&= | \|= |
\|= | &= |
๐ Back to Top
Block Statement#
Removes the content of every block statement. For example the code:
becomes:
๐ Back to Top
Boolean Literal#
Original | Mutated |
---|
true | false |
false | true |
!(a == b) | a == b ยน |
- ยน: Not supported by Stryker4s
๐ Back to Top
Checked Statement#
Stryker.NET specific mutator
Original | Mutated |
---|
checked(2 + 4) | 2 + 4 |
๐ Back to Top
Conditional Expression#
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; ยน |
- ยน: Not supported by Stryker4s
๐ Back to Top
Equality Operator#
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 ยน |
- ยน: Only supported on StrykerJS and Stryker4s
๐ Back to Top
Logical Operator#
Original | Mutated |
---|
a && b | a \|\| b |
a \|\| b | a && b |
๐ Back to Top
Method Expression#
Due to differences in language syntax, method expressions are implemented differently in each Stryker framework:
Stryker.NET:#
Original | Mutated |
---|
Distinct() | `` |
Reverse() | `` |
OrderBy() | `` |
OrderByDescending() | `` |
SingleOrDefault() | FirstOrDefault() |
FirstOrDefault() | SingleOrDefault() |
First() | Last() |
Last() | First() |
All() | Any() |
Any() | All() |
Skip() | Take() |
Take() | Skip() |
SkipWhile() | TakeWhile() |
TakeWhile() | SkipWhile() |
Min() | Max() |
Max() | Min() |
Sum() | Count() |
Count() | Sum() |
Stryker4s:#
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.take(b) | a.drop(b) |
a.drop(b) | a.take(b) |
a.takeRight(b) | a.dropRight(b) |
a.dropRight(b) | a.takeRight(b) |
a.takeWhile(b) | a.dropWhile(b) |
a.dropWhile(b) | a.takeWhile(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 |
a.maxBy(b) | a.minBy(b) |
a.minBy(b) | a.maxBy(b) |
๐ Back to Top
String Literal#
Original | Mutated |
---|
"foo" (non-empty string) | "" (empty string) |
"" (empty string) | "Stryker was here!" |
s"foo ${bar}" (string interpolation) | s"" ยน |
ยน For Stryker4s, only works with string interpolation and not other types of interpolation (like Scalameta quasiquotes) to avoid compile errors
๐ Back to Top
Unary Operator#
๐ Back to Top
Update Operator#
Original | Mutated |
---|
a++ | a-- |
a-- | a++ |
++a | --a |
--a | ++a |
๐ Back to Top