| Age | Commit message (Collapse) | Author |
|
|
|
|
|
feat(options2): better test for layered_option
|
|
Closes #1503
|
|
The existing test can be solved with the following:
```rs
while let Some(integer) = optional_integers.pop() {
assert_eq!(integer.unwrap(), range);
```
Similarly with `expect(...)`, `unwrap_or(0)`, `unwrap_or_default()`, etc. However, none of these solutions use the learning point of stacking `Option<T>`s.
The updated test can _only_ be solved by stacking `Option<T>`s:
```rs
while let Some(Some(integer)) = optional_integers.pop() {
assert_eq!(integer, cursor);
```
With the updated test, using `unwrap` or `expect` will panic when it hits the `None` value, and using `unwrap_or` or `unwrap_or_default` will cause the final `assert_eq!(cursor, 0)` to panic.
|
|
|
|
Removed unnecessary use statement
|
|
|
|
|
|
|
|
|
|
|
|
Fix assertions
|
|
Added extra test for before 10PM and updated the test for at 10PM (when it's 10PM there should already not be any ice cream left, as per the description). Also fixed the `raw_value` test, as it is later than 10PM, so there should be no more ice cream left.
|
|
Since rewriting the exercise in commit 06e4fd376586 the print_number
function goes unused. Remove it.
|
|
Expected result is updated to better showcase the difference between
- a valid result with no ice-creams `Some(0)`, and
- an invalid result `None`.
|
|
|
|
|
|
|