Skip to content

Commit 4c638e3

Browse files
author
liv
committed
Merge branch 'main' of github.com:rust-lang/rustlings
2 parents f452fd7 + 6d1f8c5 commit 4c638e3

File tree

3 files changed

+50
-9
lines changed

3 files changed

+50
-9
lines changed

.all-contributorsrc

+9
Original file line numberDiff line numberDiff line change
@@ -2109,6 +2109,15 @@
21092109
"contributions": [
21102110
"content"
21112111
]
2112+
},
2113+
{
2114+
"login": "Ben2917",
2115+
"name": "Ben",
2116+
"avatar_url": "https://avatars.githubusercontent.com/u/10279994?v=4",
2117+
"profile": "https://github.com/Ben2917",
2118+
"contributions": [
2119+
"content"
2120+
]
21122121
}
21132122
],
21142123
"contributorsPerLine": 8,

AUTHORS.md

+1
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ authors.
298298
<td align="center" valign="top" width="12.5%"><a href="https://github.com/rb5014"><img src="https://avatars.githubusercontent.com/u/105397317?v=4?s=100" width="100px;" alt="rb5014"/><br /><sub><b>rb5014</b></sub></a><br /><a href="#content-rb5014" title="Content">🖋</a></td>
299299
<td align="center" valign="top" width="12.5%"><a href="https://github.com/deedy5"><img src="https://avatars.githubusercontent.com/u/65482418?v=4?s=100" width="100px;" alt="deedy5"/><br /><sub><b>deedy5</b></sub></a><br /><a href="#content-deedy5" title="Content">🖋</a></td>
300300
<td align="center" valign="top" width="12.5%"><a href="https://github.com/lionel-rowe"><img src="https://avatars.githubusercontent.com/u/26078826?v=4?s=100" width="100px;" alt="lionel-rowe"/><br /><sub><b>lionel-rowe</b></sub></a><br /><a href="#content-lionel-rowe" title="Content">🖋</a></td>
301+
<td align="center" valign="top" width="12.5%"><a href="https://github.com/Ben2917"><img src="https://avatars.githubusercontent.com/u/10279994?v=4?s=100" width="100px;" alt="Ben"/><br /><sub><b>Ben</b></sub></a><br /><a href="#content-Ben2917" title="Content">🖋</a></td>
301302
</tr>
302303
</tbody>
303304
</table>

exercises/iterators/iterators5.rs

+40-9
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,27 @@ mod tests {
6565
}
6666

6767
#[test]
68-
fn count_equals_for() {
68+
fn count_some() {
6969
let map = get_map();
70-
assert_eq!(
71-
count_for(&map, Progress::Complete),
72-
count_iterator(&map, Progress::Complete)
73-
);
70+
assert_eq!(1, count_iterator(&map, Progress::Some));
71+
}
72+
73+
#[test]
74+
fn count_none() {
75+
let map = get_map();
76+
assert_eq!(2, count_iterator(&map, Progress::None));
77+
}
78+
79+
#[test]
80+
fn count_complete_equals_for() {
81+
let map = get_map();
82+
let progressStates = vec![Progress::Complete, Progress::Some, Progress::None];
83+
for progressState in progressStates {
84+
assert_eq!(
85+
count_for(&map, progressState),
86+
count_iterator(&map, progressState)
87+
);
88+
}
7489
}
7590

7691
#[test]
@@ -82,13 +97,29 @@ mod tests {
8297
);
8398
}
8499

100+
#[test]
101+
fn count_collection_some() {
102+
let collection = get_vec_map();
103+
assert_eq!(1, count_collection_iterator(&collection, Progress::Some));
104+
}
105+
106+
#[test]
107+
fn count_collection_none() {
108+
let collection = get_vec_map();
109+
assert_eq!(4, count_collection_iterator(&collection, Progress::None));
110+
}
111+
85112
#[test]
86113
fn count_collection_equals_for() {
114+
let progressStates = vec![Progress::Complete, Progress::Some, Progress::None];
87115
let collection = get_vec_map();
88-
assert_eq!(
89-
count_collection_for(&collection, Progress::Complete),
90-
count_collection_iterator(&collection, Progress::Complete)
91-
);
116+
117+
for progressState in progressStates {
118+
assert_eq!(
119+
count_collection_for(&collection, progressState),
120+
count_collection_iterator(&collection, progressState)
121+
);
122+
}
92123
}
93124

94125
fn get_map() -> HashMap<String, Progress> {

0 commit comments

Comments
 (0)