From 352267871cbc30d201c53179da3a31d9f5657d44 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 15 Apr 2023 17:19:16 +0100 Subject: [PATCH 1/4] fix: Added some extra tests to validate iterators5 solution closes: #1387 --- exercises/iterators/iterators5.rs | 53 ++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 8 deletions(-) diff --git a/exercises/iterators/iterators5.rs b/exercises/iterators/iterators5.rs index 8709795..45f0d48 100644 --- a/exercises/iterators/iterators5.rs +++ b/exercises/iterators/iterators5.rs @@ -65,12 +65,27 @@ mod tests { } #[test] - fn count_equals_for() { + fn count_some() { let map = get_map(); - assert_eq!( - count_for(&map, Progress::Complete), - count_iterator(&map, Progress::Complete) - ); + assert_eq!(1, count_iterator(&map, Progress::Some)); + } + + #[test] + fn count_none() { + let map = get_map(); + assert_eq!(2, count_iterator(&map, Progress::None)); + } + + #[test] + fn count_complete_equals_for() { + let map = get_map(); + let progressStates = vec![Progress::Complete, Progress::Some, Progress::None]; + for progressState in progressStates { + assert_eq!( + count_for(&map, progressState), + count_iterator(&map, progressState) + ); + } } #[test] @@ -83,14 +98,36 @@ mod tests { } #[test] - fn count_collection_equals_for() { + fn count_collection_some() { let collection = get_vec_map(); assert_eq!( - count_collection_for(&collection, Progress::Complete), - count_collection_iterator(&collection, Progress::Complete) + 1, + count_collection_iterator(&collection, Progress::Some) ); } + #[test] + fn count_collection_none() { + let collection = get_vec_map(); + assert_eq!( + 4, + count_collection_iterator(&collection, Progress::None) + ); + } + + #[test] + fn count_collection_equals_for() { + let progressStates = vec![Progress::Complete, Progress::Some, Progress::None]; + let collection = get_vec_map(); + + for progressState in progressStates { + assert_eq!( + count_collection_for(&collection, progressState), + count_collection_iterator(&collection, progressState) + ); + } + } + fn get_map() -> HashMap { use Progress::*; From a6f99645c6cb1b5493e1fbf16576ab5c0f1dd88c Mon Sep 17 00:00:00 2001 From: liv Date: Wed, 17 May 2023 16:02:39 +0200 Subject: [PATCH 2/4] chore: rustfmt --- exercises/iterators/iterators5.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/exercises/iterators/iterators5.rs b/exercises/iterators/iterators5.rs index 45f0d48..dcf0742 100644 --- a/exercises/iterators/iterators5.rs +++ b/exercises/iterators/iterators5.rs @@ -77,7 +77,7 @@ mod tests { } #[test] - fn count_complete_equals_for() { + fn count_complete_equals_for() { let map = get_map(); let progressStates = vec![Progress::Complete, Progress::Some, Progress::None]; for progressState in progressStates { @@ -100,19 +100,13 @@ mod tests { #[test] fn count_collection_some() { let collection = get_vec_map(); - assert_eq!( - 1, - count_collection_iterator(&collection, Progress::Some) - ); + assert_eq!(1, count_collection_iterator(&collection, Progress::Some)); } #[test] fn count_collection_none() { let collection = get_vec_map(); - assert_eq!( - 4, - count_collection_iterator(&collection, Progress::None) - ); + assert_eq!(4, count_collection_iterator(&collection, Progress::None)); } #[test] From af52fce275ba26b653026fffc5c09a73c7ba5846 Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 17 May 2023 14:14:43 +0000 Subject: [PATCH 3/4] docs: update AUTHORS.md [skip ci] --- AUTHORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS.md b/AUTHORS.md index c1cc60c..a27c60e 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -298,6 +298,7 @@ authors. rb5014
rb5014

🖋 deedy5
deedy5

🖋 lionel-rowe
lionel-rowe

🖋 + Ben
Ben

🖋 From ab61a0d5c7efb8cc4856587f5354fb2f9024a40a Mon Sep 17 00:00:00 2001 From: "allcontributors[bot]" <46447321+allcontributors[bot]@users.noreply.github.com> Date: Wed, 17 May 2023 14:14:44 +0000 Subject: [PATCH 4/4] docs: update .all-contributorsrc [skip ci] --- .all-contributorsrc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.all-contributorsrc b/.all-contributorsrc index 56c5e02..1b9678e 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -2109,6 +2109,15 @@ "contributions": [ "content" ] + }, + { + "login": "Ben2917", + "name": "Ben", + "avatar_url": "https://avatars.githubusercontent.com/u/10279994?v=4", + "profile": "https://github.com/Ben2917", + "contributions": [ + "content" + ] } ], "contributorsPerLine": 8,