feat(options1): update expected result
Expected result is updated to better showcase the difference between - a valid result with no ice-creams `Some(0)`, and - an invalid result `None`.
This commit is contained in:
parent
3963559810
commit
a56f648cce
@ -14,6 +14,7 @@ fn print_number(maybe_number: Option<u16>) {
|
|||||||
// TODO: Return an Option!
|
// TODO: Return an Option!
|
||||||
fn maybe_icecream(time_of_day: u16) -> Option<u16> {
|
fn maybe_icecream(time_of_day: u16) -> Option<u16> {
|
||||||
// We use the 24-hour system here, so 10PM is a value of 22
|
// We use the 24-hour system here, so 10PM is a value of 22
|
||||||
|
// The Option output should gracefully handle cases where time_of_day > 24.
|
||||||
???
|
???
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,8 +25,9 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn check_icecream() {
|
fn check_icecream() {
|
||||||
assert_eq!(maybe_icecream(10), Some(5));
|
assert_eq!(maybe_icecream(10), Some(5));
|
||||||
assert_eq!(maybe_icecream(23), None);
|
assert_eq!(maybe_icecream(23), Some(0));
|
||||||
assert_eq!(maybe_icecream(22), None);
|
assert_eq!(maybe_icecream(22), Some(0));
|
||||||
|
assert_eq!(maybe_icecream(25), None);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Reference in New Issue
Block a user