Complete test exercises ()

This commit is contained in:
Tyler Cardinal 2021-05-13 21:42:16 -05:00 committed by GitHub
parent 0ed1e16b9c
commit 4d2db50657
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 10 deletions

View file

@ -6,12 +6,10 @@
// This test has a problem with it -- make the test compile! Make the test
// pass! Make the test fail! Execute `rustlings hint tests1` for hints :)
// I AM NOT DONE
#[cfg(test)]
mod tests {
#[test]
fn you_can_assert() {
assert!();
assert!(&"Dog".to_ascii_uppercase() == "DOG");
}
}

View file

@ -2,12 +2,10 @@
// This test has a problem with it -- make the test compile! Make the test
// pass! Make the test fail! Execute `rustlings hint tests2` for hints :)
// I AM NOT DONE
#[cfg(test)]
mod tests {
#[test]
fn you_can_assert_eq() {
assert_eq!();
assert_eq!("Cat".to_string(), String::from("Cat"));
}
}

View file

@ -4,8 +4,6 @@
// we expect to get when we call `is_even(5)`.
// Execute `rustlings hint tests3` for hints :)
// I AM NOT DONE
pub fn is_even(num: i32) -> bool {
num % 2 == 0
}
@ -16,11 +14,16 @@ mod tests {
#[test]
fn is_true_when_even() {
assert!();
assert!(is_even(2));
}
#[test]
fn is_false_when_odd() {
assert!();
assert!(!is_even(3));
}
#[test]
fn is_false_when_5() {
assert!(!is_even(5));
}
}