From 78554862c84156274d3897a602b097e85c9a583b Mon Sep 17 00:00:00 2001 From: Gwilym Kuiper Date: Sun, 2 Oct 2022 19:05:29 +0100 Subject: [PATCH] Move the tests to a better location --- agb/src/hash_map.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/agb/src/hash_map.rs b/agb/src/hash_map.rs index e338a17e..d38e60c2 100644 --- a/agb/src/hash_map.rs +++ b/agb/src/hash_map.rs @@ -1263,6 +1263,22 @@ mod test { drop_registry.assert_dropped_n_times(id1, 2); } + #[test_case] + fn test_retain(_gba: &mut Gba) { + let mut map = HashMap::new(); + + for i in 0..100 { + map.insert(i, i); + } + + map.retain(|k, _| k % 2 == 0); + + assert_eq!(map[&2], 2); + assert_eq!(map.get(&3), None); + + assert_eq!(map.iter().count(), 50); // force full iteration + } + // Following test cases copied from the rust source // https://github.com/rust-lang/rust/blob/master/library/std/src/collections/hash/map/tests.rs mod rust_std_tests {