Skip to content

Commit 78a23be

Browse files
authored
Update tests3.rs
1 parent 7c0626a commit 78a23be

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

exercises/tests/tests3.rs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
// tests3.rs
2-
//
3-
// This test isn't testing our function -- make it do that in such a way that
4-
// the test passes. Then write a second test that tests whether we get the
5-
// result we expect to get when we call `is_even(5)`.
6-
//
7-
// Execute `rustlings hint tests3` or use the `hint` watch subcommand for a
8-
// hint.
9-
10-
// I AM NOT DONE
11-
121
pub fn is_even(num: i32) -> bool {
132
num % 2 == 0
143
}
@@ -19,11 +8,13 @@ mod tests {
198

209
#[test]
2110
fn is_true_when_even() {
22-
assert!();
11+
// 测试偶数:调用is_even(4)应该返回true,assert!验证条件为真
12+
assert!(is_even(4));
2313
}
2414

2515
#[test]
2616
fn is_false_when_odd() {
27-
assert!();
17+
// 测试奇数:调用is_even(5)应该返回false,assert!验证条件为假(加!取反)
18+
assert!(!is_even(5));
2819
}
2920
}

0 commit comments

Comments
 (0)