mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-26 00:00:03 +03:00
feat: added test function to hashmaps2.rs
The existing test functions only check if a kind of fruit exists in the hashmap, but not if the amount of fruits is higher than zero. This new test function solves this.
This commit is contained in:
parent
30291a3c25
commit
bbfb4c7e63
|
@ -80,4 +80,13 @@ 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() {
|
||||
assert_ne!(amount, &0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue