Skip to content

Commit bbfb4c7

Browse files
authored
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.
1 parent 30291a3 commit bbfb4c7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

exercises/hashmaps/hashmaps2.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,13 @@ mod tests {
8080
let count = basket.values().sum::<u32>();
8181
assert!(count > 11);
8282
}
83+
84+
#[test]
85+
fn all_fruit_types_in_basket() {
86+
let mut basket = get_fruit_basket();
87+
fruit_basket(&mut basket);
88+
for amount in basket.values() {
89+
assert_ne!(amount, &0);
90+
}
91+
}
8392
}

0 commit comments

Comments
 (0)