mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-11 05:09:19 +00:00
Solve quiz3.
This commit is contained in:
parent
f6c67371e8
commit
f57cd50647
@ -7,7 +7,6 @@
|
|||||||
// we expect to get when we call `times_two` with a negative number.
|
// we expect to get when we call `times_two` with a negative number.
|
||||||
// No hints, you can do this :)
|
// No hints, you can do this :)
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
pub fn times_two(num: i32) -> i32 {
|
pub fn times_two(num: i32) -> i32 {
|
||||||
num * 2
|
num * 2
|
||||||
@ -19,12 +18,11 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn returns_twice_of_positive_numbers() {
|
fn returns_twice_of_positive_numbers() {
|
||||||
assert_eq!(times_two(4), ???);
|
assert_eq!(times_two(4), 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn returns_twice_of_negative_numbers() {
|
fn returns_twice_of_negative_numbers() {
|
||||||
// TODO replace unimplemented!() with an assert for `times_two(-4)`
|
assert_eq!(times_two(-4), -8);
|
||||||
unimplemented!()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user