summaryrefslogtreecommitdiff
path: root/exercises/hashmaps/hashmaps2.rs
diff options
context:
space:
mode:
authorBert Apperlo <91734527+b-apperlo@users.noreply.github.com>2023-06-08 15:49:07 +0200
committerGitHub <noreply@github.com>2023-06-08 15:49:07 +0200
commitbbfb4c7e63dc59a4e8afbb8d2a10b35414782256 (patch)
tree6185503dbfd83336481b672d63254c571e2e160a /exercises/hashmaps/hashmaps2.rs
parent30291a3c253f08a4191cfd544ba36867612ebb7a (diff)
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.
Diffstat (limited to 'exercises/hashmaps/hashmaps2.rs')
-rw-r--r--exercises/hashmaps/hashmaps2.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/exercises/hashmaps/hashmaps2.rs b/exercises/hashmaps/hashmaps2.rs
index a4f069a..852c076 100644
--- a/exercises/hashmaps/hashmaps2.rs
+++ b/exercises/hashmaps/hashmaps2.rs
@@ -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);
+ }
+ }
}