logical_operators: Logical operator mutators

View source: R/mutator-presets.R

logical_operatorsR Documentation

Logical operator mutators

Description

Returns a ready-made list of operator() mutators covering short-circuit (&&/||) and vectorised (&/|) logical operator swaps.

Usage

logical_operators()

Details

Use on any file with compound conditions (⁠if (a && b)⁠). A surviving mutant from this preset typically means test inputs are symmetric — both flags TRUE or both FALSE. Adding a test with one flag TRUE and the other FALSE exposes the difference between && and || and kills the mutant.

Value

A list of operator() mutators.

See Also

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

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

Examples

logical_operators()

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

## End(Not run)

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