Swift edition
Arithmetic
Operators that change a calculation: its operator, a sign, or the bits it combines. They ask whether a test checks the number a calculation gives, not only that it gives one.
| Operator | Changes | Set |
|---|---|---|
mutastic/math | + and -, * and /, &+ and &-, and their compound forms | defaults |
mutastic/other-arithmetic | each of + - * / % to the others | stronger |
mutastic/remove-negation | -x to x | stronger |
mutastic/bitwise | &, | and ^ to the other two | stronger |
The mutants each makes, on samples/operators/Sources/Operators/Arithmetic.swift:
mutastic mutants samples/operators --at=Sources/Operators/Arithmetic.swift:1-99 --operators=mutastic/math,mutastic/other-arithmetic,mutastic/remove-negation,mutastic/bitwisem546da426 Sources/Operators/Arithmetic.swift:3:9 mutastic/other-arithmetic price * quantity becomes price % quantity in lineTotalm73992666 Sources/Operators/Arithmetic.swift:3:9 mutastic/other-arithmetic price * quantity becomes price + quantity in lineTotalm6f1bd46c Sources/Operators/Arithmetic.swift:3:9 mutastic/other-arithmetic price * quantity becomes price - quantity in lineTotalm8d1a47d8 Sources/Operators/Arithmetic.swift:3:9 mutastic/math * becomes / in lineTotalm4a608996 Sources/Operators/Arithmetic.swift:8:3 mutastic/remove-negation -amount becomes amount in refundm1c0ebdba Sources/Operators/Arithmetic.swift:13:9 mutastic/bitwise flags & flag becomes (flags ^ flag) in hasFlagm272c1d6b Sources/Operators/Arithmetic.swift:13:9 mutastic/bitwise flags & flag becomes (flags | flag) in hasFlagno estimate: no run is recorded here yet; run once to get estimates, or add --estimate7 mutantsmutastic/math, in the defaults. + becomes -, * becomes /, &+ becomes &-, += becomes -=, and the other way round.
Other arithmetic
Section titled “Other arithmetic”mutastic/other-arithmetic, in stronger. Each of +, -, *, / and % becomes each of the others that mutastic/math doesn’t make, and the same for their compound forms; % isn’t made on a floating-point value, which has none.
Remove negation
Section titled “Remove negation”mutastic/remove-negation, in stronger. A minus in front of a value is taken away.
Bitwise
Section titled “Bitwise”mutastic/bitwise, in stronger. Each of &, | and ^ becomes each of the other two.
- Every operator, in one table.