Skip to content
mutastic

Swift edition

Library methods

Operators that swap a standard library method for its counterpart: the other end, the other case, the other bound.

OperatorChangesSet
library/swap-stringhasPrefix and hasSuffix, uppercased and lowercaseddefaults
library/swap-mathmin and max, floor and ceildefaults
library/swap-endsfirst and last, and the methods that work at either endstronger
library/swap-index-offirstIndex and lastIndexstronger

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

Terminal window
mutastic mutants samples/operators --at=Sources/Operators/Library.swift:1-99 --operators=library/swap-string,library/swap-math,library/swap-ends,library/swap-index-of
Terminal window
m3a3f396b Sources/Operators/Library.swift:3:8 library/swap-string hasPrefix becomes hasSuffix in isComment
m19ec4f44 Sources/Operators/Library.swift:8:3 library/swap-math min becomes max in cappedDiscount
m0d9b5f2c Sources/Operators/Library.swift:13:10 library/swap-ends last becomes first in latest
mcf206182 Sources/Operators/Library.swift:18:8 library/swap-index-of lastIndex becomes firstIndex in extensionStart
no estimate: no run is recorded here yet; run once to get estimates, or add --estimate
4 mutants

library/swap-string, in the defaults. Each becomes its counterpart.

library/swap-math, in the defaults. Each becomes its counterpart.

library/swap-ends, in stronger. first and last, removeFirst and removeLast, popFirst and popLast, dropFirst and dropLast, and prefix and suffix each become the other.

library/swap-index-of, in stronger. Each becomes the other. Only a test with the value there twice tells them apart.