Mutation Operators Supported by mutator
operators.RdThis help page lists the mutation operators that the mutator package supports for mutation testing in R.
Details
The following mutation operators can be applied to R code:
cxx_add_to_sub: Replaces+with-cxx_and_to_or: Replaces\&with|cxx_assign_const: Replacesa = bwitha = 42cxx_div_to_mul: Replaces/with*cxx_eq_to_ne: Replaces==with!=cxx_ge_to_gt: Replaces>=with>cxx_ge_to_lt: Replaces>=with<cxx_gt_to_ge: Replaces>with>=cxx_gt_to_le: Replaces>with<=cxx_le_to_gt: Replaces<=with>cxx_le_to_lt: Replaces<=with<cxx_logical_and_to_or: Replaces&&with||cxx_logical_or_to_and: Replaces||with&&cxx_lt_to_ge: Replaces<with>=cxx_lt_to_le: Replaces<with<=cxx_minus_to_noop: Replaces-xwithxcxx_mul_to_div: Replaces*with/cxx_ne_to_eq: Replaces!=with==cxx_or_to_and: Replaces|with\&cxx_remove_negation: Replaces!awithacxx_replace_scalar_call: Replaces a function call with42cxx_sub_to_add: Replaces-with+negate_mutator: Negates conditionals!xtoxandxto!xscalar_value_mutator: Replaces zeros with42, and non-zeros with0
These operators allow the mutator package to systematically alter source code in controlled ways, enabling thorough testing of R code and ensuring that tests are sensitive to subtle code changes.