chore(tests): update tests3.rs

added macros assert_eq!() and assert_ne!() and added a further information link
This commit is contained in:
Zerotask 2021-04-24 23:15:00 +02:00
parent 84461c20cb
commit 509be08a52
No known key found for this signature in database
GPG key ID: 1C87F67E23FCB283
2 changed files with 10 additions and 4 deletions
exercises/tests

View file

@ -5,3 +5,4 @@ Going out of order from the book to cover tests -- many of the following exercis
## Further information
- [Writing Tests](https://doc.rust-lang.org/book/ch11-01-writing-tests.html)
- [Unit testing](https://doc.rust-lang.org/stable/rust-by-example/testing/unit_testing.html)

View file

@ -1,11 +1,11 @@
// tests3.rs
// This test isn't testing our function -- make it do that in such a way that
// the test passes. Then write a second test that tests whether we get the result
// we expect to get when we call `is_even(5)`.
// the test passes, but just replace the ???
// Execute `rustlings hint tests3` for hints :)
// I AM NOT DONE
// Don't modify this function
pub fn is_even(num: i32) -> bool {
num % 2 == 0
}
@ -16,11 +16,16 @@ mod tests {
#[test]
fn is_true_when_even() {
assert!();
assert!(???);
}
#[test]
fn is_false_when_odd() {
assert!();
assert_eq!(false, ???);
}
#[test]
fn is_false_when_odd2() {
assert_ne!(true, ???);
}
}