Skip to main content

OperatorSet

Trait OperatorSet 

Source
pub trait OperatorSet {
    // Required methods
    fn regex_operators(&self) -> Result<Vec<MutationOperator>, Error>;
    fn security_operators(&self) -> Result<Vec<MutationOperator>, Error>;
    fn test_operators(&self) -> Result<Vec<MutationOperator>, Error>;
    fn do_not_mutate_patterns(&self) -> Vec<&'static str>;
    fn do_not_mutate_py_patterns(&self) -> Vec<&'static str>;
    fn do_not_mutate_unit_patterns(&self) -> Vec<&'static str>;
    fn skip_if_contain_patterns(&self) -> Vec<&'static str>;
    fn test_line_skip_prefixes(&self) -> Vec<&'static str>;

    // Provided method
    fn should_mutate_test_line(&self, line: &str) -> bool { ... }
}
Expand description

The mutation operators and skip rules for a single project.

Each project (Bitcoin Core, secp256k1, …) provides its own operators and “do not mutate” lists. Implementations typically compose the language-level operators in [common] with project-specific additions.

Required Methods§

Source

fn regex_operators(&self) -> Result<Vec<MutationOperator>, Error>

Operators applied to general (non-test) source files.

Source

fn security_operators(&self) -> Result<Vec<MutationOperator>, Error>

Operators applied when --only-security-mutations is set.

Source

fn test_operators(&self) -> Result<Vec<MutationOperator>, Error>

Operators applied to test files (unit and, where applicable, functional).

Source

fn do_not_mutate_patterns(&self) -> Vec<&'static str>

Line prefixes that disable mutation of a line entirely.

Source

fn do_not_mutate_py_patterns(&self) -> Vec<&'static str>

Substrings that disable mutation of a Python test line.

Source

fn do_not_mutate_unit_patterns(&self) -> Vec<&'static str>

Substrings that disable mutation of a (C/C++) unit-test line.

Source

fn skip_if_contain_patterns(&self) -> Vec<&'static str>

Substrings that disable mutation of any line when contained.

Source

fn test_line_skip_prefixes(&self) -> Vec<&'static str>

Prefixes that mark a test line as not worth mutating (asserts, helpers). Consumed by the default OperatorSet::should_mutate_test_line.

Provided Methods§

Source

fn should_mutate_test_line(&self, line: &str) -> bool

Whether a test line should be mutated by OperatorSet::test_operators.

Default behaviour: skip lines starting with any OperatorSet::test_line_skip_prefixes, then only mutate lines that look like a standalone function call.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§