Commit graph

17 commits

Author SHA1 Message Date
liv 81cd97902a
Merge pull request #1487 from lionel-rowe/patch-1
feat(options2): better test for layered_option
2023-05-17 15:56:55 +02:00
Noah May 3ecb47ff2c fix(options3): panic when not matching to avoid false positives
Closes #1503
2023-05-09 15:13:18 -05: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
Ali Afsharzadeh 382e16eb7e feat(docs): add markdown linter for exercises README.md files 2023-03-30 19:53:22 +03:30
liv f123cb2777
Merge pull request #1228 from grzegorz-zur/patch-1
Removed unnecessary use statement
2023-02-12 16:54:43 +01:00
TK Buristrakul a315f2fefb chore: added more descriptive TODOs 2022-11-24 19:39:54 +00:00
bhbuehler c157c53983 docs(options1): fix and clarify 24 hour time instruction 2022-10-11 12:05:37 -05: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
vostok92 4455c22b9a
Update options1.rs
Fix assertions
2022-08-17 13:51:17 +09:00
Nico Vromans e8122daa87
Update options1.rs
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.
2022-08-15 10:05:50 +02:00
Markus Boehme 3c84cc1702 fix(options1): remove unused code
Since rewriting the exercise in commit 06e4fd3765 the print_number
function goes unused. Remove it.
2022-08-11 22:54:08 +02:00
Tristan Nicholls a56f648cce 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`.
2022-07-26 21:01:09 +02:00
mokou b71feed824 feat(options): add hint comments 2022-07-14 17:53:42 +02:00
mokou 06e4fd3765 feat(options1): rewrite to remove array stuff 2022-07-14 17:53:27 +02:00
mokou b644558c19 fix: rename option to options 2022-07-14 17:34:50 +02:00