arithmetic_operators: Arithmetic operator mutators

View source: R/mutator-presets.R

arithmetic_operatorsR Documentation

Arithmetic operator mutators

Description

Returns a ready-made list of operator() mutators covering common arithmetic swaps: +/-, *//, ^/*, %%/*, %/%//.

Usage

arithmetic_operators()

Details

Use on any file that performs calculations. A surviving mutant from this preset typically means an assertion checks a property of the result (sign, order) rather than a specific value — replacing expect_gte() with expect_equal() and a computed expected value usually kills it.

Value

A list of operator() mutators.

See Also

vignette("mutators", package = "muttest") for the full operator table and a worked example showing the direction-insensitive assertion pattern.

vignette("interpreting-results", package = "muttest") for how to diagnose survivors and fix the underlying test weakness.

Examples

arithmetic_operators()

## Not run: 
plan <- muttest_plan(
  source_files = "R/stats.R",
  mutators = arithmetic_operators()
)
muttest(plan, "tests/testthat")

## End(Not run)

muttest documentation built on May 14, 2026, 5:10 p.m.