From bbfb4c7e63dc59a4e8afbb8d2a10b35414782256 Mon Sep 17 00:00:00 2001 From: Bert Apperlo <91734527+b-apperlo@users.noreply.github.com> Date: Thu, 8 Jun 2023 15:49:07 +0200 Subject: [PATCH] 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. --- exercises/hashmaps/hashmaps2.rs | 9 +++++++++ 1 file changed, 9 insertions(+) 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::(); 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); + } + } }