diff --git a/containers-tests/tests/intmap-properties.hs b/containers-tests/tests/intmap-properties.hs index b533cfb70..915d202ad 100644 --- a/containers-tests/tests/intmap-properties.hs +++ b/containers-tests/tests/intmap-properties.hs @@ -183,8 +183,8 @@ main = defaultMain $ testGroup "intmap-properties" , testProperty "deleteMin" prop_deleteMinModel , testProperty "deleteMax" prop_deleteMaxModel , testProperty "filter" prop_filter - , testProperty "filterWithKey" prop_filterWithKey , testProperty "filterKeys" prop_filterKeys + , testProperty "filterWithKey" prop_filterWithKey , testProperty "partition" prop_partition , testProperty "takeWhileAntitone" prop_takeWhileAntitone , testProperty "dropWhileAntitone" prop_dropWhileAntitone @@ -1514,18 +1514,18 @@ prop_filter p ys = length ys > 0 ==> in valid m .&&. m === fromList (List.filter (apply p . snd) xs) -prop_filterWithKey :: Fun (Int, Int) Bool -> [(Int, Int)] -> Property -prop_filterWithKey p ys = length ys > 0 ==> - let xs = List.nubBy ((==) `on` fst) ys - m = fromList xs - in filterWithKey (\k v -> apply p (k, v)) m == fromList (List.filter (\(k, v) -> apply p (k, v)) xs) - prop_filterKeys :: Fun Int Bool -> [(Int, Int)] -> Property prop_filterKeys p ys = length ys > 0 ==> let xs = List.nubBy ((==) `on` fst) ys m = fromList xs in filterKeys (apply p) m == fromList (List.filter (apply p . fst) xs) +prop_filterWithKey :: Fun (Int, Int) Bool -> [(Int, Int)] -> Property +prop_filterWithKey p ys = length ys > 0 ==> + let xs = List.nubBy ((==) `on` fst) ys + m = fromList xs + in filterWithKey (\k v -> apply p (k, v)) m == fromList (List.filter (\(k, v) -> apply p (k, v)) xs) + prop_partition :: Fun Int Bool -> [(Int, Int)] -> Property prop_partition p ys = length ys > 0 ==> let xs = List.nubBy ((==) `on` fst) ys diff --git a/containers-tests/tests/map-properties.hs b/containers-tests/tests/map-properties.hs index edc1b1b12..8614b9d42 100644 --- a/containers-tests/tests/map-properties.hs +++ b/containers-tests/tests/map-properties.hs @@ -224,8 +224,8 @@ main = defaultMain $ testGroup "map-properties" , testProperty "deleteMin" prop_deleteMinModel , testProperty "deleteMax" prop_deleteMaxModel , testProperty "filter" prop_filter - , testProperty "filterWithKey" prop_filterWithKey , testProperty "filterKeys" prop_filterKeys + , testProperty "filterWithKey" prop_filterWithKey , testProperty "partition" prop_partition , testProperty "map" prop_map , testProperty "fmap" prop_fmap @@ -1469,18 +1469,18 @@ prop_filter p ys = length ys > 0 ==> m = fromList xs in filter (apply p) m == fromList (List.filter (apply p . snd) xs) -prop_filterWithKey :: Fun (Int, Int) Bool -> IMap -> Property -prop_filterWithKey fun m = - valid m' .&&. toList m' === Prelude.filter (apply fun) (toList m) - where - m' = filterWithKey (apply2 fun) m - prop_filterKeys :: Fun Int Bool -> IMap -> Property prop_filterKeys fun m = valid m' .&&. toList m' === Prelude.filter (apply fun . fst) (toList m) where m' = filterKeys (apply fun) m +prop_filterWithKey :: Fun (Int, Int) Bool -> IMap -> Property +prop_filterWithKey fun m = + valid m' .&&. toList m' === Prelude.filter (apply fun) (toList m) + where + m' = filterWithKey (apply2 fun) m + prop_take :: Int -> Map Int Int -> Property prop_take n xs = valid taken .&&. taken === fromDistinctAscList (List.take n (toList xs))