Compare commits

...

7 commits

Author SHA1 Message Date
Daniel Somerfield 84eef8aee6
Merge 8bfe2ec71e into 8d0aa11a35 2024-01-15 20:53:29 +06:00
liv 8d0aa11a35
Merge pull request #1826 from rust-lang/all-contributors/add-gerases
docs: add gerases as a contributor for content
2024-01-15 14:52:04 +00:00
allcontributors[bot] e2674498c6
docs: update .all-contributorsrc [skip ci] 2024-01-15 14:51:48 +00:00
allcontributors[bot] 3200581d4d
docs: update AUTHORS.md [skip ci] 2024-01-15 14:51:47 +00:00
liv 6afc4840b4
Merge pull request #1819 from gerases/grammar-fix
Correct for more standard English
2024-01-15 14:51:31 +00:00
Sergei Gerasenko 93aef73eb5 Correct for more standard English 2024-01-09 10:17:03 -06:00
Daniel Somerfield 8bfe2ec71e Fix all_fruits_types_in_basket to fail if all fruit kinds are not included 2023-11-21 14:02:26 -08:00
4 changed files with 27 additions and 4 deletions

View file

@ -2550,6 +2550,15 @@
"contributions": [
"content"
]
},
{
"login": "gerases",
"name": "gerases",
"avatar_url": "https://avatars.githubusercontent.com/u/8953623?v=4",
"profile": "https://github.com/gerases",
"contributions": [
"content"
]
}
],
"contributorsPerLine": 8,

View file

@ -360,6 +360,9 @@ authors.
<td align="center" valign="top" width="12.5%"><a href="https://github.com/neuschaefer"><img src="https://avatars.githubusercontent.com/u/1021512?v=4?s=100" width="100px;" alt="J. Neuschäfer"/><br /><sub><b>J. Neuschäfer</b></sub></a><br /><a href="https://github.com/rust-lang/rustlings/commits?author=neuschaefer" title="Code">💻</a></td>
<td align="center" valign="top" width="12.5%"><a href="https://scooterhacking.org"><img src="https://avatars.githubusercontent.com/u/58905488?v=4?s=100" width="100px;" alt="Bastian Pedersen"/><br /><sub><b>Bastian Pedersen</b></sub></a><br /><a href="#content-bastianpedersen" title="Content">🖋</a></td>
</tr>
<tr>
<td align="center" valign="top" width="12.5%"><a href="https://github.com/gerases"><img src="https://avatars.githubusercontent.com/u/8953623?v=4?s=100" width="100px;" alt="gerases"/><br /><sub><b>gerases</b></sub></a><br /><a href="#content-gerases" title="Content">🖋</a></td>
</tr>
</tbody>
</table>

View file

@ -18,7 +18,7 @@
use std::collections::HashMap;
#[derive(Hash, PartialEq, Eq)]
#[derive(Hash, PartialEq, Eq, Debug)]
enum Fruit {
Apple,
Banana,
@ -27,6 +27,14 @@ enum Fruit {
Pineapple,
}
const FRUIT_KINDS: [Fruit; 5] = [
Fruit::Apple,
Fruit::Banana,
Fruit::Mango,
Fruit::Lychee,
Fruit::Pineapple,
];
fn fruit_basket(basket: &mut HashMap<Fruit, u32>) {
let fruit_kinds = vec![
Fruit::Apple,
@ -81,12 +89,15 @@ mod tests {
let count = basket.values().sum::<u32>();
assert!(count > 11);
}
#[test]
fn all_fruit_types_in_basket() {
let mut basket = get_fruit_basket();
fruit_basket(&mut basket);
for amount in basket.values() {
for fruit_kind in FRUIT_KINDS {
let amount = basket
.get(&fruit_kind)
.expect(format!("Fruit kind {:?} was not found in basket", fruit_kind).as_str());
assert_ne!(amount, &0);
}
}

View file

@ -36,7 +36,7 @@ fn build_scores_table(results: String) -> HashMap<String, Team> {
let team_2_score: u8 = v[3].parse().unwrap();
// TODO: Populate the scores table with details extracted from the
// current line. Keep in mind that goals scored by team_1
// will be the number of goals conceded from team_2, and similarly
// will be the number of goals conceded by team_2, and similarly
// goals scored by team_2 will be the number of goals conceded by
// team_1.
}