summaryrefslogtreecommitdiffstats
path: root/test cases/rust/9 unit tests/test.rs
blob: 0225be55b9b0da44f68463c08775a077a0b479e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
pub fn add(a: i32, b: i32) -> i32 {
    return a + b;
}

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

    #[test]
    fn test_add() {
        assert_eq!(add(1, 2), 3);
    }

    #[test]
    fn test_add_intentional_fail() {
        assert_eq!(add(1, 2), 5);
    }

    #[test]
    #[ignore]
    fn test_add_intentional_fail2() {
        assert_eq!(add(1, 7), 5);
    }
}