You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 4, 2020. It is now read-only.
instancearbMap :: (Eqk, Ordk, Arbitraryk, Arbitraryv) =>Arbitrary (M.Mapkv) where
19
-
arbitrary = M.fromList <$> arbitrary
18
+
newtypeTestMapkv = TestMap (M.Mapkv)
20
19
21
-
instancearbitraryList :: (Arbitrarya) =>Arbitrary (Lista) where
22
-
arbitrary = toList <$> (arbitrary::Gen (Arraya))
20
+
instancearbTestMap :: (Eqk, Ordk, Arbitraryk, Arbitraryv) =>Arbitrary (TestMapkv) where
21
+
arbitrary = TestMap <<< M.fromList <$> arbitrary
23
22
24
23
dataSmallKey = A|B|C|D|E|F|G|H|I|J
25
24
@@ -160,7 +159,7 @@ mapTests = do
160
159
in f (f arr) == f (arr ::List (TupleSmallKeyInt)) <?> show arr
161
160
162
161
log "fromList . toList = id"
163
-
quickCheck $ \m->let f m = M.fromList (M.toList m) in
162
+
quickCheck $ \(TestMap m)->let f m = M.fromList (M.toList m) in
164
163
M.toList (f m) == M.toList (m ::M.MapSmallKeyInt) <?> show m
165
164
166
165
log "fromListWith const = fromList"
@@ -176,26 +175,27 @@ mapTests = do
176
175
M.fromListWith (<>) arr == f (arr ::List (TupleStringString)) <?> show arr
177
176
178
177
log "Lookup from union"
179
-
quickCheck $ \m1 m2 k ->M.lookup (smallKey k) (M.union m1 m2) == (caseM.lookup k m1 of
180
-
Nothing->M.lookup k m2
181
-
Just v ->Just (number v)) <?> ("m1: " ++ show m1 ++ ", m2: " ++ show m2 ++ ", k: " ++ show k ++ ", v1: " ++ show (M.lookup k m1) ++ ", v2: " ++ show (M.lookup k m2) ++ ", union: " ++ show (M.union m1 m2))
178
+
quickCheck $ \(TestMap m1) (TestMap m2) k ->
179
+
M.lookup (smallKey k) (M.union m1 m2) == (caseM.lookup k m1 of
180
+
Nothing->M.lookup k m2
181
+
Just v ->Just (number v)) <?> ("m1: " ++ show m1 ++ ", m2: " ++ show m2 ++ ", k: " ++ show k ++ ", v1: " ++ show (M.lookup k m1) ++ ", v2: " ++ show (M.lookup k m2) ++ ", union: " ++ show (M.union m1 m2))
in f (f arr) == f (arr ::List (TupleStringInt)) <?> show arr
89
88
90
89
log "fromList . toList = id"
91
-
quickCheck $ \m ->let f m = M.fromList (M.toList m) in
92
-
M.toList (f m) == M.toList (m ::M.StrMapInt) <?> show m
90
+
quickCheck $ \(TestStrMap m) ->
91
+
let f m = M.fromList (M.toList m) in
92
+
M.toList (f m) == M.toList (m ::M.StrMapInt) <?> show m
93
93
94
94
log "fromListWith const = fromList"
95
95
quickCheck $ \arr ->M.fromListWith const arr ==
@@ -104,12 +104,14 @@ strMapTests = do
104
104
M.fromListWith (<>) arr == f (arr ::List (TupleStringString)) <?> show arr
105
105
106
106
log "Lookup from union"
107
-
quickCheck $ \m1 m2 k ->M.lookup k (M.union m1 m2) == (caseM.lookup k m1 of
108
-
Nothing->M.lookup k m2
109
-
Just v ->Just (number v)) <?> ("m1: " ++ show m1 ++ ", m2: " ++ show m2 ++ ", k: " ++ show k ++ ", v1: " ++ show (M.lookup k m1) ++ ", v2: " ++ show (M.lookup k m2) ++ ", union: " ++ show (M.union m1 m2))
107
+
quickCheck $ \(TestStrMap m1) (TestStrMap m2) k ->
108
+
M.lookup k (M.union m1 m2) == (caseM.lookup k m1 of
109
+
Nothing->M.lookup k m2
110
+
Just v ->Just (number v)) <?> ("m1: " ++ show m1 ++ ", m2: " ++ show m2 ++ ", k: " ++ show k ++ ", v1: " ++ show (M.lookup k m1) ++ ", v2: " ++ show (M.lookup k m2) ++ ", union: " ++ show (M.union m1 m2))
0 commit comments