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.
<?> ("k1: " ++ show k1 ++ ", v1: " ++ show v1 ++ ", k2: " ++ show k2 ++ ", v2: " ++ show v2)
131
131
132
-
trace"Check balance property"
133
-
quickCheck' (fromNumber 5000) $ \instrs ->
132
+
log"Check balance property"
133
+
quickCheck' 5000 $ \instrs ->
134
134
let
135
-
tree::M.MapSmallKeyNumber
135
+
tree::M.MapSmallKeyInt
136
136
tree = runInstructions instrs M.empty
137
137
inM.checkValid tree <?> ("Map not balanced:\n" ++ show tree ++ "\nGenerated by:\n" ++ show instrs)
138
138
139
-
trace"Lookup from empty"
140
-
quickCheck $ \k ->M.lookup k (M.empty ::M.MapSmallKeyNumber) == Nothing
139
+
log"Lookup from empty"
140
+
quickCheck $ \k ->M.lookup k (M.empty ::M.MapSmallKeyInt) == Nothing
141
141
142
-
trace"Lookup from singleton"
143
-
quickCheck $ \k v ->M.lookup (k ::SmallKey) (M.singleton k (v ::Number)) == Just v
142
+
log"Lookup from singleton"
143
+
quickCheck $ \k v ->M.lookup (k ::SmallKey) (M.singleton k (v ::Int)) == Just v
144
144
145
-
trace"Random lookup"
146
-
quickCheck' (fromNumber 5000) $ \instrs k v ->
145
+
log"Random lookup"
146
+
quickCheck' 5000 $ \instrs k v ->
147
147
let
148
-
tree::M.MapSmallKeyNumber
148
+
tree::M.MapSmallKeyInt
149
149
tree = M.insert k v (runInstructions instrs M.empty)
150
150
inM.lookup k tree == Just v <?> ("instrs:\n" ++ show instrs ++ "\nk:\n" ++ show k ++ "\nv:\n" ++ show v)
151
151
152
-
trace"Singleton to list"
153
-
quickCheck $ \k v ->M.toList (M.singleton k v ::M.MapSmallKeyNumber) == [Tuple k v]
152
+
log"Singleton to list"
153
+
quickCheck $ \k v ->M.toList (M.singleton k v ::M.MapSmallKeyInt) == singleton (Tuple k v)
154
154
155
-
trace"toList . fromList = id"
155
+
log"toList . fromList = id"
156
156
quickCheck $ \arr ->let f x = M.toList (M.fromList x)
157
-
in f (f arr) == f (arr ::[TupleSmallKeyNumber]) <?> show arr
157
+
in f (f arr) == f (arr ::List (TupleSmallKeyInt)) <?> show arr
158
158
159
-
trace"fromList . toList = id"
159
+
log"fromList . toList = id"
160
160
quickCheck $ \m ->let f m = M.fromList (M.toList m) in
161
-
M.toList (f m) == M.toList (m ::M.MapSmallKeyNumber) <?> show m
161
+
M.toList (f m) == M.toList (m ::M.MapSmallKeyInt) <?> show m
162
162
163
-
trace"fromListWith const = fromList"
163
+
log"fromListWith const = fromList"
164
164
quickCheck $ \arr ->M.fromListWith const arr ==
165
-
M.fromList (arr ::[TupleSmallKeyNumber]) <?> show arr
165
+
M.fromList (arr ::List (TupleSmallKeyInt)) <?> show arr
166
166
167
-
trace"fromListWith (<>) = fromList . collapse with (<>) . group on fst"
167
+
log"fromListWith (<>) = fromList . collapse with (<>) . group on fst"
168
168
quickCheck $ \arr ->
169
169
let combine (Tuple s a) (Tuple t b) = (Tuple s $ b <> a)
170
-
foldl1 g (x : xs) = foldl g x xs
170
+
foldl1 g (Cons x xs) = foldl g x xs
171
171
f = M.fromList <<< (<$>) (foldl1 combine) <<<
172
172
groupBy ((==) `on` fst) <<< sortBy (compare `on` fst) in
173
-
M.fromListWith (<>) arr == f (arr ::[TupleStringString]) <?> show arr
173
+
M.fromListWith (<>) arr == f (arr ::List (TupleStringString)) <?> show arr
174
174
175
-
trace"Lookup from union"
175
+
log"Lookup from union"
176
176
quickCheck $ \m1 m2 k ->M.lookup (smallKey k) (M.union m1 m2) == (caseM.lookup k m1 of
177
177
Nothing->M.lookup k m2
178
178
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