Exercise - Write unit tests
In this exercise, you'll write two test functions for the is_even
function. You'll know the exercise is complete after the code compiles and both tests pass. You should edit only the body of the two test functions.
pub fn is_even(num: i32) -> bool {
num % 2 == 0
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn is_true_when_even() {
assert!();
}
#[test]
fn is_false_when_odd() {
assert!();
}
}
You can also view this exercise at this Rust Playground link.
To find the solution for this exercise, check out this Rust Playground link.