cargo-mutants 27.0.0

Inject bugs and see if your tests catch them
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
pub fn factorial(n: u32) -> u32 {
    let mut a = 1;
    for i in 2..=n {
        a *= i;
    }
    a
}

#[cfg(test)]
mod test {
    use super::*;

    #[test]
    fn test_factorial() {
        println!("factorial({}) = {}", 6, factorial(6));
        assert_eq!(factorial(6), 720);
    }
}