Skip to content
mutastic

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.

OperatorChangesSet
mutastic/math+ and -, * and /, &+ and &-, and their compound formsdefaults
mutastic/other-arithmeticeach of + - * / % to the othersstronger
mutastic/remove-negation-x to xstronger
mutastic/bitwise&, | and ^ to the other twostronger

The mutants each makes, on samples/operators/Sources/Operators/Arithmetic.swift:

Terminal window
mutastic mutants samples/operators --at=Sources/Operators/Arithmetic.swift:1-99 --operators=mutastic/math,mutastic/other-arithmetic,mutastic/remove-negation,mutastic/bitwise
Terminal window
m546da426 Sources/Operators/Arithmetic.swift:3:9 mutastic/other-arithmetic price * quantity becomes price % quantity in lineTotal
m73992666 Sources/Operators/Arithmetic.swift:3:9 mutastic/other-arithmetic price * quantity becomes price + quantity in lineTotal
m6f1bd46c Sources/Operators/Arithmetic.swift:3:9 mutastic/other-arithmetic price * quantity becomes price - quantity in lineTotal
m8d1a47d8 Sources/Operators/Arithmetic.swift:3:9 mutastic/math * becomes / in lineTotal
m4a608996 Sources/Operators/Arithmetic.swift:8:3 mutastic/remove-negation -amount becomes amount in refund
m1c0ebdba Sources/Operators/Arithmetic.swift:13:9 mutastic/bitwise flags & flag becomes (flags ^ flag) in hasFlag
m272c1d6b Sources/Operators/Arithmetic.swift:13:9 mutastic/bitwise flags & flag becomes (flags | flag) in hasFlag
no estimate: no run is recorded here yet; run once to get estimates, or add --estimate
7 mutants

mutastic/math, in the defaults. + becomes -, * becomes /, &+ becomes &-, += becomes -=, and the other way round.

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.

mutastic/remove-negation, in stronger. A minus in front of a value is taken away.

mutastic/bitwise, in stronger. Each of &, | and ^ becomes each of the other two.