tests1.rs (512B)
1 // Tests are important to ensure that your code does what you think it should 2 // do. 3 4 fn is_even(n: i64) -> bool { 5 n % 2 == 0 6 } 7 8 fn main() { 9 // You can optionally experiment here. 10 } 11 12 #[cfg(test)] 13 mod tests { 14 // TODO: Import `is_even`. You can use a wildcard to import everything in 15 // the outer module. 16 use crate::is_even; 17 18 #[test] 19 fn you_can_assert() { 20 // TODO: Test the function `is_even` with some values. 21 assert!(!is_even(1)); 22 assert!(is_even(2)); 23 } 24 }