Mutation Operators
Mutagoph includes 23 mutation operators organized by category.
Arithmetic Operators
| Operator |
Description |
Example |
arithmetic_replace |
Replace arithmetic operators |
a + b → a - b |
arithmetic_delete |
Remove one operand |
a + b → a |
Comparison Operators
| Operator |
Description |
Example |
comparison_replace |
Replace comparison operators |
a == b → a != b |
comparison_boundary |
Modify boundary conditions |
a < b → a <= b |
Logical Operators
| Operator |
Description |
Example |
logical_replace |
Replace logical operators |
a && b → a \|\| b |
Bitwise Operators
| Operator |
Description |
Example |
bitwise_replace |
Replace bitwise operators |
a & b → a \| b |
bitwise_assign |
Replace bitwise assignment |
a &= b → a \|= b |
Literal Mutations
| Operator |
Description |
Example |
literal_replace |
Replace numeric literals |
0 → 1, 42 → 43 |
bool_replace |
Flip boolean literals |
true → false |
string_replace |
Replace string literals |
"hello" → "" |
Statement Mutations
| Operator |
Description |
Example |
statement_delete |
Delete statement |
x = 5 → (removed) |
return_replace |
Replace return with zero value |
return x → return 0 |
Assignment Mutations
| Operator |
Description |
Example |
assign_replace |
Replace assignment operators |
x += 1 → x -= 1 |
Conditional Mutations
| Operator |
Description |
Example |
condition_negate |
Negate condition |
if x > 0 → if !(x > 0) |
condition_remove |
Remove conditional |
if x { body } → body |
else_remove |
Remove else branch |
if x {} else { y } → if x {} |
Loop Mutations
| Operator |
Description |
Example |
loop_break |
Swap break/continue |
break → continue |
loop_condition |
Modify loop condition |
for i < n → for true |
loop_range_break |
Add break to range loop |
for range x { body } → for range x { body; break } |
Expression Mutations
| Operator |
Description |
Example |
call_silence |
Silence function call |
f() → _ = f() |
return_remove |
Remove return statement |
return x, err → (removed) |
slice_boundary |
Modify slice boundaries |
s[:2] → s[:1] |
Switch Mutations
| Operator |
Description |
Example |
switch_case |
Remove or swap switch cases |
case body removed |
Operator Categories
Mutations target different aspects of code:
- Arithmetic/Comparison - Mathematical and logical correctness
- Literals - Constant values and boundaries
- Control Flow - Branches, loops, returns
- Statements - Side effects and assignments
A high mutation score indicates your tests verify all these aspects thoroughly.