Add tests to result

New mutants found in weekly mutation testing.

Add tests to kill them.
This commit is contained in:
Jamil Lambert, PhD 2025-05-20 16:04:59 +01:00
parent c1d2f0386d
commit 24cc059a78
No known key found for this signature in database
GPG Key ID: 54DC29234AB5D2C0
1 changed files with 31 additions and 0 deletions

View File

@ -311,3 +311,34 @@ impl fmt::Display for MathOp {
}
}
}
#[cfg(test)]
mod tests {
use crate::MathOp;
#[test]
fn mathop_predicates() {
assert!(MathOp::Add.is_overflow());
assert!(MathOp::Sub.is_overflow());
assert!(MathOp::Mul.is_overflow());
assert!(MathOp::Neg.is_overflow());
assert!(!MathOp::Div.is_overflow());
assert!(!MathOp::Rem.is_overflow());
assert!(MathOp::Div.is_div_by_zero());
assert!(MathOp::Rem.is_div_by_zero());
assert!(!MathOp::Add.is_div_by_zero());
assert!(MathOp::Add.is_addition());
assert!(!MathOp::Sub.is_addition());
assert!(MathOp::Sub.is_subtraction());
assert!(!MathOp::Add.is_subtraction());
assert!(MathOp::Mul.is_multiplication());
assert!(!MathOp::Div.is_multiplication());
assert!(MathOp::Neg.is_negation());
assert!(!MathOp::Add.is_negation());
}
}