on master help sign in
Make variable naming a little more meaningful in unfold tests
603a722adithyaov
test/Streamly/Test/Data/Unfold.hs+21−18
@@ -107,8 +107,11 @@ swap =
107fromStream :: Property
107fromStream :: Property
108fromStream =
108fromStream =
109 property
109 property
110− $ \n ->
110+ $ \list ->
111+ testUnfoldD
112+ UF.fromStream
111− testUnfoldD UF.fromStream (S.fromList n :: SerialT Identity Int) n
113+ (S.fromList list :: SerialT Identity Int)
114+ list
112
115
113fromStreamD :: Property
116fromStreamD :: Property
114fromStreamD =
117fromStreamD =
@@ -161,9 +164,9 @@ unfoldrM =
161fromListM :: Property
164fromListM :: Property
162fromListM =
165fromListM =
163 property
166 property
164− $ \n ->
167+ $ \list ->
165− let lst = Prelude.map (\x -> modify (+ 1) >> return x) n
168+ let listM = Prelude.map (\x -> modify (+ 1) >> return x) list
166− in testUnfoldMD UF.fromListM lst 0 (length n) n
169+ in testUnfoldMD UF.fromListM listM 0 (length list) list
167
170
168replicateM :: Property
171replicateM :: Property
169replicateM =
172replicateM =
@@ -266,49 +269,49 @@ take =
266takeWhileM :: Property
269takeWhileM :: Property
267takeWhileM =
270takeWhileM =
268 property
271 property
269− $ \f n ->
272+ $ \f list ->
270 let fM x =
273 let fM x =
271 if apply f x
274 if apply f x
272 then modify (+ 1) >> return True
275 then modify (+ 1) >> return True
273 else return False
276 else return False
274 unf = UF.takeWhileM fM UF.fromList
277 unf = UF.takeWhileM fM UF.fromList
275− fL = Prelude.takeWhile (apply f) n
278+ fL = Prelude.takeWhile (apply f) list
276 fS = Prelude.length fL
279 fS = Prelude.length fL
277− in testUnfoldMD unf n 0 fS fL
280+ in testUnfoldMD unf list 0 fS fL
278
281
279filterM :: Property
282filterM :: Property
280filterM =
283filterM =
281 property
284 property
282− $ \f n ->
285+ $ \f list ->
283 let fM x =
286 let fM x =
284 if apply f x
287 if apply f x
285 then modify (+ 1) >> return True
288 then modify (+ 1) >> return True
286 else return False
289 else return False
287 unf = UF.filterM fM UF.fromList
290 unf = UF.filterM fM UF.fromList
288− fL = Prelude.filter (apply f) n
291+ fL = Prelude.filter (apply f) list
289 fS = Prelude.length fL
292 fS = Prelude.length fL
290− in testUnfoldMD unf n 0 fS fL
293+ in testUnfoldMD unf list 0 fS fL
291
294
292drop :: Property
295drop :: Property
293drop =
296drop =
294 property
297 property
295− $ \i n ->
298+ $ \i list ->
296 let unf = UF.drop i UF.fromList
299 let unf = UF.drop i UF.fromList
297− fL = Prelude.drop i n
300+ fL = Prelude.drop i list
298− in testUnfoldD unf n fL
301+ in testUnfoldD unf list fL
299
302
300dropWhileM :: Property
303dropWhileM :: Property
301dropWhileM =
304dropWhileM =
302 property
305 property
303− $ \f n ->
306+ $ \f list ->
304 let fM x =
307 let fM x =
305 if apply f x
308 if apply f x
306 then modify (+ 1) >> return True
309 then modify (+ 1) >> return True
307 else return False
310 else return False
308 unf = UF.dropWhileM fM UF.fromList
311 unf = UF.dropWhileM fM UF.fromList
309− fL = Prelude.dropWhile (apply f) n
312+ fL = Prelude.dropWhile (apply f) list
310− fS = Prelude.length n - Prelude.length fL
313+ fS = Prelude.length list - Prelude.length fL
311− in testUnfoldMD unf n 0 fS fL
314+ in testUnfoldMD unf list 0 fS fL
312
315
313-------------------------------------------------------------------------------
316-------------------------------------------------------------------------------
314-- Stream combination
317-- Stream combination