1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#[cfg(test)] mod tests { // use super::*; #[test] fn it_works() { let result = 2 + 2; assert_eq!(result, 4); } #[test] fn does_add() { let result = super::add(2, 5); assert_eq!(result, 7); } } pub fn add(a: i32, b: i32) -> i32 { a + b }