chore(tests): update tests3.rs
added macros assert_eq!() and assert_ne!() and added a further information link
This commit is contained in:
parent
84461c20cb
commit
509be08a52
|
@ -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)
|
||||
|
|
|
@ -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, ???);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue