Commit Graph

8 Commits

Author SHA1 Message Date
c415145547
finish till errors 2024-01-29 23:19:46 +05:30
Robert Fry
7eef5d15ee
docs: cleanup the explanation paragraphs at the start of each exercise. 2023-05-29 18:41:51 +01:00
lionel-rowe
836134202e
feat(options2): better tests for layered_option
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.
2023-04-21 06:05:25 +01:00
Grzegorz Żur
da6178bdc6
Removed unnecessary use statement 2022-10-11 10:43:32 +02:00
magnusrodseth
99ea2cbba7 chore: make options2 not compile deliberately 2022-08-17 16:53:41 +02:00
magnusrodseth
52a29aa84b test: Convert main function to working tests 2022-08-17 12:50:34 +02:00
mokou
b71feed824 feat(options): add hint comments 2022-07-14 17:53:42 +02:00
mokou
b644558c19 fix: rename option to options 2022-07-14 17:34:50 +02:00