Merge pull request #1112 from tvkn/feat/options1/update-expected-result

feat(options1): update expected result
This commit is contained in:
liv 2022-08-03 17:34:43 +02:00 committed by GitHub
commit affc815447
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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]