Skip to content

Commit

Permalink
Order of functions in source files
Browse files Browse the repository at this point in the history
  • Loading branch information
flip111 committed Nov 19, 2024
1 parent 3198115 commit 2279b03
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions containers-tests/tests/intmap-properties.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions containers-tests/tests/map-properties.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit 2279b03

Please sign in to comment.