-
Notifications
You must be signed in to change notification settings - Fork 10
Supported Mutations
Oli Wennell edited this page Apr 23, 2019
·
6 revisions
Fettle supports the following mutations:
-
Conditional Operator
-
Equality Operators
-
Increment/Decrement Operators
-
Logical Operators
-
Mathematical Operators
-
Mathematical Assignment Operators
-
Relational Operators
-
If Statement Condition
-
Null-Coalescing Expressions
Swaps the left-hand and right-hand expressions of a conditional operator:
E.g.
var x = isEnabled ? 10 : 0;
var x = isEnabled ? 0 : 10;
Inverts equality operators: ==
, !=
E.g.
var b = a == 10;
var b = a != 10;
Negates increment and decrement operators: a`, `a--`, `a
, --a
E.g.
for (int i = 0; i < 10; ++a)
for (int i = 0; i < 10; --a)
Inverts logical operators: &&
, ||
E.g.
var c = a && b;
var c = a || b;
Swaps mathematical operators: +
, -
, *
, /
, %
E.g.
var c = a + b;
var c = a - b;
Swaps mathematical assignment operators: +=
, -=
, *=
, /=
, %=
E.g.
a += 3;
a -= 3;
Swaps relational operators: >
, >=
, <
, ⇐
E.g.
for (int i = 0; i < 10; ++a)
for (int i = 0; i <= 10; ++a)
Negates the condition of if
statements.
E.g. if (x)
mutates to if (!x)
.
E.g. if (!x)
mutates to if (x)
.