From 5ca7cbba1e580240d67670ecfd3fc300051be59a Mon Sep 17 00:00:00 2001 From: Martin Ockajak Date: Sat, 20 Jul 2024 01:23:47 +0200 Subject: [PATCH] . --- tests/extensions/map.rs | 40 +++++++++++++++++++------------------- tests/extensions/traits.rs | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/extensions/map.rs b/tests/extensions/map.rs index 3aedb45..2284d1e 100644 --- a/tests/extensions/map.rs +++ b/tests/extensions/map.rs @@ -17,7 +17,7 @@ where + Equal + Debug + 'a, - C::This: FromIterator<(i64, i64)> + Equal + Debug, + C::This: FromIterator<(i64, i64)> + Default + Extend<(i64, i64)> + Equal + Debug, { // add let a = a_source.clone(); @@ -248,25 +248,25 @@ where assert_map_equal(e_even, HashMap::new()); assert_map_equal(e_odd, HashMap::new()); - // partition_map - FIXME - implement test - // let a = a_source.clone(); - // let e = e_source.clone(); - // let (a_even, a_odd) = a.partition_map(|(&k, &v)| if k % 2 == 0 { Ok((k + 3, v)) } else { Err((k, v)) }); - // assert_map_equal(a_even, HashMap::from([(5, 2),])); - // assert_map_equal(a_odd, HashMap::from([(1, 1), (3, 3),])); - // let (e_even, e_odd) = a.partition_map(|(&k, &v)| if k % 2 == 0 { Ok((k + 3, v)) } else { Err((k, v)) }); - // assert_map_equal(e_even, HashMap::new()); - // assert_map_equal(e_odd, HashMap::new()); - - // partition_map_to - FIXME - implement test - // let a = a_source.clone(); - // let e = e_source.clone(); - // let (a_even, a_odd) = a.partition_map_to(|(k, v)| if k % 2 == 0 { Ok((k + 3, v)) } else { Err((k, v)) }); - // assert_map_equal(a_even, HashMap::from([(5, 2),])); - // assert_map_equal(a_odd, HashMap::from([(1, 1), (3, 3),])); - // let (e_even, e_odd) = a.partition_map_to(|(k, v)| if k % 2 == 0 { Ok((k + 3, v)) } else { Err((k, v)) }); - // assert_map_equal(e_even, HashMap::new()); - // assert_map_equal(e_odd, HashMap::new()); + // partition_map + let a = a_source.clone(); + let e = e_source.clone(); + let (a_even, a_odd) = a.partition_map(|(&k, &v)| if k % 2 == 0 { Ok((k + 3, v)) } else { Err((k, v)) }); + assert_map_equal(a_even, HashMap::from([(5, 2),])); + assert_map_equal(a_odd, HashMap::from([(1, 1), (3, 3),])); + let (e_even, e_odd) = e.partition_map(|(&k, &v)| if k % 2 == 0 { Ok((k + 3, v)) } else { Err((k, v)) }); + assert_map_equal(e_even, HashMap::new()); + assert_map_equal(e_odd, HashMap::new()); + + // partition_map_to + let a = a_source.clone(); + let e = e_source.clone(); + let (a_even, a_odd) = a.partition_map_to(|(k, v)| if k % 2 == 0 { Ok((k + 3, v)) } else { Err((k, v)) }); + assert_map_equal(a_even, HashMap::from([(5, 2),])); + assert_map_equal(a_odd, HashMap::from([(1, 1), (3, 3),])); + let (e_even, e_odd) = e.partition_map_to(|(k, v)| if k % 2 == 0 { Ok((k + 3, v)) } else { Err((k, v)) }); + assert_map_equal(e_even, HashMap::new()); + assert_map_equal(e_odd, HashMap::new()); // product_keys let a = a_source.clone(); diff --git a/tests/extensions/traits.rs b/tests/extensions/traits.rs index 62fc8ea..b742e2f 100644 --- a/tests/extensions/traits.rs +++ b/tests/extensions/traits.rs @@ -110,7 +110,7 @@ where + Equal + Debug + 'a, - >::This: FromIterator<(i64, i64)> + Equal + Debug, + >::This: FromIterator<(i64, i64)> + Default + Extend<(i64, i64)> + Equal + Debug, { test_map(a, b, e); }