condition_mutations: Condition mutation mutators

View source: R/mutator-presets.R

condition_mutationsR Documentation

Condition mutation mutators

Description

Returns a ready-made list of negate_condition() and remove_condition_negation() mutators covering both directions of condition logic: wrapping a plain condition in !(...) and stripping ! from an already-negated condition.

Usage

condition_mutations()

Details

Use on any file with non-trivial if/while conditions. Surviving mutants mean the branch outcome was never tested with inputs that cross the boundary — adding a test where the condition flips from TRUE to FALSE kills them.

Value

A list of mutators.

See Also

vignette("mutators", package = "muttest") for the full mutator table.

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

Examples

condition_mutations()

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

## End(Not run)

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