@@ -4,43 +4,86 @@ import qualified Streamly.Internal.Data.Parser.ParserD as D
44import qualified Streamly.Internal.Prelude as S
55import qualified Streamly.Internal.Data.Fold as FL
66
7+-- import Data.List (partition)
8+
79import Test.Hspec(hspec, describe)
810import Test.Hspec.QuickCheck
9−import Test.QuickCheck (forAll, chooseInt, Property, property, listOf, vectorOf, (.&&.))
11+import Test.QuickCheck (forAll, choose, Property, property, listOf, vectorOf, counterexample, (.&&.), Gen)
12+
13+import Test.QuickCheck.Monadic (monadicIO, PropertyM, assert, monitor)
14+import Control.Monad.IO.Class (MonadIO(..))
15+import Control.Monad (when)
16+import Data.List ((\\))
17+
18+min_value :: Int
19+min_value = 0
20+
21+mid_value :: Int
22+mid_value = 5000
23+
24+max_value :: Int
25+max_value = 10000
26+
27+max_length :: Int
28+max_length = 1000
29+
30+listEquals :: (Show a, Eq a, MonadIO m)
31+ => ([a] -> [a] -> Bool) -> [a] -> [a] -> PropertyM m ()
32+listEquals eq parsed_list list = do
33+ when (not $ parsed_list `eq` list) $ liftIO $ putStrLn $
34+ "parsed list " ++ show parsed_list
35+ ++ "\nlist " ++ show list
36+ ++ "\nparsed list \\\\ list " ++ show (parsed_list \\ list)
37+ ++ "\nlist \\\\ parsed list " ++ show (list \\ parsed_list)
38+ when (not $ parsed_list `eq` list) $
39+ monitor
40+ (counterexample $
41+ "parsed list " ++ show parsed_list
42+ ++ "\nlist " ++ show list
43+ ++ "\nparsed list \\\\ list " ++ show (parsed_list \\ list)
44+ ++ "\nlist \\\\ parsed list " ++ show (list \\ parsed_list)
45+ )
46+ assert (parsed_list `eq` list)
47+
48+checkListEqual :: (Show a, Eq a) => [a] -> [a] -> Property
49+checkListEqual ls_1 ls_2 = monadicIO (listEquals (==) ls_1 ls_2)
50+
51+chooseInt :: (Int, Int) -> Gen Int
52+chooseInt = choose
1053
1154-- Accumulator Tests
1255
1356fromFold :: Property
1457fromFold =
15− forAll (listOf $ chooseInt (0, 10000)) $ \ls ->
58+ forAll (listOf $ chooseInt (min_value, max_value)) $ \ls ->
1659 case (==) <$> (S.parseD (D.fromFold FL.sum) (S.fromList ls)) <*> (S.fold FL.sum (S.fromList ls)) of
1760 Right is_equal -> is_equal
1861 Left _ -> False
1962
2063any :: Property
2164any =
22− forAll (listOf $ chooseInt (0, 10000)) $ \ls ->
23− case S.parseD (D.any (> 5000)) (S.fromList ls) of
24− Right r -> r == (Prelude.any (> 5000) ls)
65+ forAll (listOf $ chooseInt (min_value, max_value)) $ \ls ->
66+ case S.parseD (D.any (> mid_value)) (S.fromList ls) of
67+ Right r -> r == (Prelude.any (> mid_value) ls)
2568 Left _ -> False
2669
2770all :: Property
2871all =
29− forAll (listOf $ chooseInt (0, 10000)) $ \ls ->
30− case S.parseD (D.all (> 5000)) (S.fromList ls) of
31− Right r -> r == (Prelude.all (> 5000) ls)
72+ forAll (listOf $ chooseInt (min_value, max_value)) $ \ls ->
73+ case S.parseD (D.all (> mid_value)) (S.fromList ls) of
74+ Right r -> r == (Prelude.all (> mid_value) ls)
3275 Left _ -> False
3376
3477yield :: Property
3578yield =
36− forAll (chooseInt (0, 10000)) $ \x ->
79+ forAll (chooseInt (min_value, max_value)) $ \x ->
3780 case S.parseD (D.yield x) (S.fromList [1 :: Int]) of
3881 Right r -> r == x
3982 Left _ -> False
4083
4184yieldM :: Property
4285yieldM =
43− forAll (chooseInt (0, 10000)) $ \x ->
86+ forAll (chooseInt (min_value, max_value)) $ \x ->
4487 case S.parseD (D.yieldM $ return x) (S.fromList [1 :: Int]) of
4588 Right r -> r == x
4689 Left _ -> False
@@ -61,35 +104,51 @@ dieM =
61104
62105-- Element Parser Tests
63106
64−peek :: Property
65−peek =
66− forAll (chooseInt (1, 100)) $ \list_length ->
67− forAll (vectorOf list_length (chooseInt (0, 10000))) $ \ls ->
107+peekPass :: Property
108+peekPass =
109+ forAll (chooseInt (1, max_length)) $ \list_length ->
110+ forAll (vectorOf list_length (chooseInt (min_value, max_value))) $ \ls ->
68111 case S.parseD D.peek (S.fromList ls) of
69112 Right head_value -> case ls of
70113 head_ls : _ -> head_value == head_ls
71114 _ -> False
72115 Left _ -> False
73− .&&.
116+
117+peekFail :: Property
118+peekFail =
74119 property (case S.parseD D.peek (S.fromList []) of
75120 Right _ -> False
76121 Left _ -> True)
77122
78−eof :: Property
79−eof =
80− forAll (chooseInt (1, 100)) $ \list_length ->
81− forAll (vectorOf list_length (chooseInt (0, 10000))) $ \ls ->
82− case S.parseD D.eof (S.fromList ls) of
83− Right _ -> False
84− Left _ -> True
85− .&&.
123+eofPass :: Property
124+eofPass =
86125 property (case S.parseD D.eof (S.fromList []) of
87126 Right _ -> True
88127 Left _ -> False)
89128
129+eofFail :: Property
130+eofFail =
131+ forAll (chooseInt (1, max_length)) $ \list_length ->
132+ forAll (vectorOf list_length (chooseInt (min_value, max_value))) $ \ls ->
133+ case S.parseD D.eof (S.fromList ls) of
134+ Right _ -> False
135+ Left _ -> True
136+
137+satisfyPass :: Property
138+satisfyPass =
139+ forAll (chooseInt (mid_value, max_value)) $ \first_element ->
140+ forAll (listOf (chooseInt (min_value, max_value))) $ \ls_tail ->
141+ let
142+ ls = first_element : ls_tail
143+ predicate = (>= mid_value)
144+ in
145+ case S.parseD (D.satisfy predicate) (S.fromList ls) of
146+ Right r -> r == first_element
147+ Left _ -> False
148+
90149satisfy :: Property
91150satisfy =
92− forAll (listOf (chooseInt (0, 10000))) $ \ls ->
151+ forAll (listOf (chooseInt (min_value, max_value))) $ \ls ->
93152 case S.parseD (D.satisfy predicate) (S.fromList ls) of
94153 Right r -> case ls of
95154 [] -> False
@@ -98,43 +157,101 @@ satisfy =
98157 [] -> True
99158 (x : _) -> not $ predicate x
100159 where
101− predicate = (>= 5000)
160+ predicate = (>= mid_value)
102161
103162-- Sequence Parsers Tests
104163
105164take :: Property
106165take =
107− forAll (chooseInt (0, 10000)) $ \n ->
108− forAll (listOf (chooseInt (0, 10000))) $ \ls ->
166+ forAll (chooseInt (min_value, max_value)) $ \n ->
167+ forAll (listOf (chooseInt (min_value, max_value))) $ \ls ->
109168 case S.parseD (D.take n FL.toList) (S.fromList ls) of
110− Right parsed_list -> parsed_list == Prelude.take n ls
111− Left _ -> False
169+ Right parsed_list -> checkListEqual parsed_list (Prelude.take n ls)
170+ Left _ -> property False
171+
172+takeEQPass :: Property
173+takeEQPass =
174+ forAll (chooseInt (min_value, max_value)) $ \n ->
175+ forAll (chooseInt (n, max_value)) $ \list_length ->
176+ forAll (vectorOf list_length (chooseInt (min_value, max_value))) $ \ls ->
177+ case S.parseD (D.takeEQ n FL.toList) (S.fromList ls) of
178+ Right parsed_list -> checkListEqual parsed_list (Prelude.take n ls)
179+ Left _ -> property False
112180
113181takeEQ :: Property
114182takeEQ =
115− forAll (chooseInt (0, 10000)) $ \n ->
116− forAll (listOf (chooseInt (0, 10000))) $ \ls ->
183+ forAll (chooseInt (min_value, max_value)) $ \n ->
184+ forAll (listOf (chooseInt (min_value, max_value))) $ \ls ->
117185 let
118186 list_length = Prelude.length ls
119187 in
120188 case S.parseD (D.takeEQ n FL.toList) (S.fromList ls) of
121− Right parsed_list -> (n <= list_length) && (parsed_list == Prelude.take n ls)
122− Left _ -> n > list_length
189+ Right parsed_list ->
190+ if (n <= list_length) then
191+ checkListEqual parsed_list (Prelude.take n ls)
192+ else
193+ property False
194+ Left _ -> property (n > list_length)
195+
196+takeGEPass :: Property
197+takeGEPass =
198+ forAll (chooseInt (min_value, max_value)) $ \n ->
199+ forAll (chooseInt (n, max_value)) $ \list_length ->
200+ forAll (vectorOf list_length (chooseInt (min_value, max_value))) $ \ls ->
201+ case S.parseD (D.takeGE n FL.toList) (S.fromList ls) of
202+ Right parsed_list -> checkListEqual parsed_list ls
203+ Left _ -> property False
123204
124205takeGE :: Property
125206takeGE =
126− forAll (chooseInt (0, 10000)) $ \n ->
127− forAll (listOf (chooseInt (0, 10000))) $ \ls ->
207+ forAll (chooseInt (min_value, max_value)) $ \n ->
208+ forAll (listOf (chooseInt (min_value, max_value))) $ \ls ->
128209 let
129210 list_length = Prelude.length ls
130211 in
131212 case S.parseD (D.takeGE n FL.toList) (S.fromList ls) of
132− Right parsed_list -> (n <= list_length) && (parsed_list == ls)
133− Left _ -> n > list_length
213+ Right parsed_list ->
214+ if (n <= list_length) then
215+ checkListEqual parsed_list ls
216+ else
217+ property False
218+ Left _ -> property (n > list_length)
219+
220+lookAheadPass :: Property
221+lookAheadPass =
222+ forAll (chooseInt (min_value + 1, max_value)) $ \n ->
223+ let
224+ takeWithoutConsume = D.lookAhead $ D.take n FL.toList
225+ parseTwice = do
226+ parsed_list_1 <- takeWithoutConsume
227+ parsed_list_2 <- takeWithoutConsume
228+ return (parsed_list_1, parsed_list_2)
229+ in
230+ forAll (chooseInt (n, max_value)) $ \list_length ->
231+ forAll (vectorOf list_length (chooseInt (min_value, max_value))) $ \ls ->
232+ case S.parseD parseTwice (S.fromList ls) of
233+ Right (ls_1, ls_2) -> checkListEqual ls_1 ls_2 .&&. checkListEqual ls_1 (Prelude.take n ls)
234+ Left _ -> property $ False
235+
236+lookAheadFail :: Property
237+lookAheadFail =
238+ forAll (chooseInt (min_value + 1, max_value)) $ \n ->
239+ let
240+ takeWithoutConsume = D.lookAhead $ D.take n FL.toList
241+ parseTwice = do
242+ parsed_list_1 <- takeWithoutConsume
243+ parsed_list_2 <- takeWithoutConsume
244+ return (parsed_list_1, parsed_list_2)
245+ in
246+ forAll (chooseInt (min_value, n - 1)) $ \list_length ->
247+ forAll (vectorOf list_length (chooseInt (min_value, max_value))) $ \ls ->
248+ case S.parseD parseTwice (S.fromList ls) of
249+ Right _ -> False
250+ Left _ -> True
134251
135252lookAhead :: Property
136253lookAhead =
137− forAll (chooseInt (0, 10000)) $ \n ->
254+ forAll (chooseInt (min_value, max_value)) $ \n ->
138255 let
139256 takeWithoutConsume = D.lookAhead $ D.take n FL.toList
140257 parseTwice = do
@@ -142,19 +259,19 @@ lookAhead =
142259 parsed_list_2 <- takeWithoutConsume
143260 return (parsed_list_1, parsed_list_2)
144261 in
145− forAll (listOf (chooseInt (0, 10000))) $ \ls ->
262+ forAll (listOf (chooseInt (min_value, max_value))) $ \ls ->
146263 case S.parseD parseTwice (S.fromList ls) of
147− Right (ls_1, ls_2) -> (ls_1 == ls_2) && (ls_1 == Prelude.take n ls)
148− Left _ -> (list_length < n) || (list_length == n && n == 0)
264+ Right (ls_1, ls_2) -> checkListEqual ls_1 ls_2 .&&. checkListEqual ls_1 (Prelude.take n ls)
265+ Left _ -> property ((list_length < n) || (list_length == n && n == 0))
149266 where
150267 list_length = Prelude.length ls
151268
152269takeWhile :: Property
153270takeWhile =
154271 forAll (listOf (chooseInt (0, 1))) $ \ ls ->
155− case S.parseD (D.takeWhile predicate FL.toList) (S.fromList ls) of
156− Right parsed_list -> parsed_list == Prelude.takeWhile predicate ls
157− Left _ -> False
272+ case S.parseD (D.takeWhile predicate FL.toList) (S.fromList ls) of
273+ Right parsed_list -> checkListEqual parsed_list (Prelude.takeWhile predicate ls)
274+ Left _ -> property False
158275 where
159276 predicate = (== 0)
160277
@@ -163,11 +280,15 @@ takeWhile1 =
163280 forAll (listOf (chooseInt (0, 1))) $ \ ls ->
164281 case S.parseD (D.takeWhile1 predicate FL.toList) (S.fromList ls) of
165282 Right parsed_list -> case ls of
166− [] -> False
167− (x : _) -> predicate x && (parsed_list == Prelude.takeWhile predicate ls)
283+ [] -> property False
284+ (x : _) ->
285+ if predicate x then
286+ checkListEqual parsed_list (Prelude.takeWhile predicate ls)
287+ else
288+ property False
168289 Left _ -> case ls of
169− [] -> True
170− (x : _) -> not $ predicate x
290+ [] -> property True
291+ (x : _) -> property (not $ predicate x)
171292 where
172293 predicate = (== 0)
173294
@@ -175,20 +296,20 @@ sliceSepBy :: Property
175296sliceSepBy =
176297 forAll (listOf (chooseInt (0, 1))) $ \ls ->
177298 case S.parseD (D.sliceSepBy predicate FL.toList) (S.fromList ls) of
178− Right parsed_list -> parsed_list == Prelude.takeWhile (not . predicate) ls
179− Left _ -> False
299+ Right parsed_list -> checkListEqual parsed_list (Prelude.takeWhile (not . predicate) ls)
300+ Left _ -> property False
180301 where
181302 predicate = (== 1)
182303
183−-- sliceSepByMax :: Property
184−-- sliceSepByMax =
185−-- forAll (chooseInt (0, 10000)) $ \n ->
186−-- forAll (listOf (chooseInt (0, 1))) $ \ls ->
187−-- case S.parseD (D.sliceSepByMax predicate n FL.toList) (S.fromList ls) of
188−-- Right parsed_list -> parsed_list == Prelude.take n (Prelude.takeWhile (not . predicate) ls)
189−-- Left _ -> False
190−-- where
191−-- predicate = (== 1)
304+sliceSepByMax :: Property
305+sliceSepByMax =
306+ forAll (chooseInt (min_value, max_value)) $ \n ->
307+ forAll (listOf (chooseInt (0, 1))) $ \ls ->
308+ case S.parseD (D.sliceSepByMax predicate n FL.toList) (S.fromList ls) of
309+ Right parsed_list -> checkListEqual parsed_list (Prelude.take n (Prelude.takeWhile (not . predicate) ls))
310+ Left _ -> property False
311+ where
312+ predicate = (== 1)
192313
193314splitWith :: Property
194315splitWith =
@@ -200,86 +321,112 @@ splitWith =
200321 Left _ -> case ls of
201322 0 : 1 : _ -> False
202323 _ -> True
203− .&&.
324+
325+splitWithFailLeft :: Property
326+splitWithFailLeft =
204327 property (case S.parseD (D.splitWith (,) (D.die "die") (D.yield (1 :: Int))) (S.fromList [1 :: Int]) of
205328 Right _ -> False
206329 Left _ -> True)
207− .&&.
330+
331+splitWithFailRight :: Property
332+splitWithFailRight =
208333 property (case S.parseD (D.splitWith (,) (D.yield (1 :: Int)) (D.die "die")) (S.fromList [1 :: Int]) of
209334 Right _ -> False
210335 Left _ -> True)
211− .&&.
336+
337+splitWithFailBoth :: Property
338+splitWithFailBoth =
212339 property (case S.parseD (D.splitWith (,) (D.die "die") (D.die "die")) (S.fromList [1 :: Int]) of
213340 Right _ -> False
214341 Left _ -> True)
215342
216−teeWith :: Property
217−teeWith =
218− forAll (chooseInt (0, 10000)) $ \n ->
343+teeWithPass :: Property
344+teeWithPass =
345+ forAll (chooseInt (min_value, max_value)) $ \n ->
219346 forAll (listOf (chooseInt (0, 1))) $ \ls ->
220347 let
221348 prsr = D.take n FL.toList
222349 in
223350 case S.parseD (D.teeWith (,) prsr prsr) (S.fromList ls) of
224− Right (ls_1, ls_2) -> (Prelude.take n ls == ls_1) && (ls_1 == ls_2)
225− Left _ -> False
226− .&&.
351+ Right (ls_1, ls_2) -> checkListEqual (Prelude.take n ls) ls_1 .&&. checkListEqual ls_1 ls_2
352+ Left _ -> property False
353+
354+teeWithFailLeft :: Property
355+teeWithFailLeft =
227356 property (case S.parseD (D.teeWith (,) (D.die "die") (D.yield (1 :: Int))) (S.fromList [1 :: Int]) of
228357 Right _ -> False
229358 Left _ -> True)
230− .&&.
359+
360+teeWithFailRight :: Property
361+teeWithFailRight =
231362 property (case S.parseD (D.teeWith (,) (D.yield (1 :: Int)) (D.die "die")) (S.fromList [1 :: Int]) of
232363 Right _ -> False
233364 Left _ -> True)
234− .&&.
365+
366+teeWithFailBoth :: Property
367+teeWithFailBoth =
235368 property (case S.parseD (D.teeWith (,) (D.die "die") (D.die "die")) (S.fromList [1 :: Int]) of
236369 Right _ -> False
237370 Left _ -> True)
238371
239−shortest :: Property
240−shortest =
241− forAll (listOf (chooseInt(0, 10000))) $ \ls ->
372+shortestPass :: Property
373+shortestPass =
374+ forAll (listOf (chooseInt(min_value, max_value))) $ \ls ->
242375 let
243− prsr_1 = D.takeWhile (<= 2500) FL.toList
244− prsr_2 = D.takeWhile (<= 5000) FL.toList
376+ half_mid_value = mid_value `Prelude.div` 2
377+ prsr_1 = D.takeWhile (<= half_mid_value) FL.toList
378+ prsr_2 = D.takeWhile (<= mid_value) FL.toList
245379 prsr_shortest = D.shortest prsr_1 prsr_2
246380 in
247381 case S.parseD prsr_shortest (S.fromList ls) of
248− Right short_list -> short_list == Prelude.takeWhile (<= 2500) ls
249− Left _ -> False
250− .&&.
382+ Right short_list -> checkListEqual short_list (Prelude.takeWhile (<= half_mid_value) ls)
383+ Left _ -> property False
384+
385+shortestPassLeft :: Property
386+shortestPassLeft =
251387 property (case S.parseD (D.shortest (D.die "die") (D.yield (1 :: Int))) (S.fromList [1 :: Int]) of
252388 Right r -> r == 1
253389 Left _ -> False)
254− .&&.
390+
391+shortestPassRight :: Property
392+shortestPassRight =
255393 property (case S.parseD (D.shortest (D.yield (1 :: Int)) (D.die "die")) (S.fromList [1 :: Int]) of
256394 Right r -> r == 1
257395 Left _ -> False)
258− .&&.
396+
397+shortestFailBoth :: Property
398+shortestFailBoth =
259399 property (case S.parseD (D.shortest (D.die "die") (D.die "die")) (S.fromList [1 :: Int]) of
260400 Right _ -> False
261401 Left _ -> True)
262402
263−longest :: Property
264−longest =
265− forAll (listOf (chooseInt(0, 10000))) $ \ls ->
403+longestPass :: Property
404+longestPass =
405+ forAll (listOf (chooseInt(min_value, max_value))) $ \ls ->
266406 let
267− prsr_1 = D.takeWhile (<= 2500) FL.toList
268− prsr_2 = D.takeWhile (<= 5000) FL.toList
407+ half_mid_value = mid_value `Prelude.div` 2
408+ prsr_1 = D.takeWhile (<= half_mid_value) FL.toList
409+ prsr_2 = D.takeWhile (<= mid_value) FL.toList
269410 prsr_longest = D.longest prsr_1 prsr_2
270411 in
271412 case S.parseD prsr_longest (S.fromList ls) of
272− Right long_list -> long_list == Prelude.takeWhile (<= 5000) ls
413+ Right long_list -> long_list == Prelude.takeWhile (<= mid_value) ls
273414 Left _ -> False
274− .&&.
415+
416+longestPassLeft :: Property
417+longestPassLeft =
275418 property (case S.parseD (D.shortest (D.die "die") (D.yield (1 :: Int))) (S.fromList [1 :: Int]) of
276419 Right r -> r == 1
277420 Left _ -> False)
278− .&&.
421+
422+longestPassRight :: Property
423+longestPassRight =
279424 property (case S.parseD (D.shortest (D.yield (1 :: Int)) (D.die "die")) (S.fromList [1 :: Int]) of
280425 Right r -> r == 1
281426 Left _ -> False)
282− .&&.
427+
428+longestFailBoth :: Property
429+longestFailBoth =
283430 property (case S.parseD (D.shortest (D.die "die") (D.die "die")) (S.fromList [1 :: Int]) of
284431 Right _ -> False
285432 Left _ -> True)
@@ -292,12 +439,14 @@ many =
292439 prsr = D.many concatFold $ D.sliceSepBy (== 1) FL.toList
293440 in
294441 case S.parseD prsr (S.fromList ls) of
295− Right res_list -> res_list == Prelude.filter (== 0) ls
296− Left _ -> False
297− .&&.
442+ Right res_list -> checkListEqual res_list (Prelude.filter (== 0) ls)
443+ Left _ -> property False
444+
445+many_empty :: Property
446+many_empty =
298447 property (case S.parseD (D.many FL.toList (D.die "die")) (S.fromList [1 :: Int]) of
299− Right res_list -> res_list == ([] :: [Int])
300− Left _ -> False)
448+ Right res_list -> checkListEqual res_list ([] :: [Int])
449+ Left _ -> property False)
301450
302451-- some :: Property
303452-- some =
@@ -309,7 +458,9 @@ many =
309458-- case S.parseD prsr (S.fromList ls) of
310459-- Right res_list -> res_list == Prelude.filter (== 0) ls
311460-- Left _ -> False
312−-- .&&.
461+
462+-- someFail :: Property
463+-- someFail =
313464-- property (case S.parseD (D.some FL.toList (D.die "die")) (S.fromList [1 :: Int]) of
314465-- Right _ -> False
315466-- Left _ -> True)
@@ -317,31 +468,52 @@ many =
317468main :: IO ()
318469main = hspec $ do
319470 describe "test for accumulator" $ do
320− prop "test fromFold function" fromFold
321− prop "test any function" Main.any
322− prop "test all function" Main.all
323− prop "test yield function" yield
324− prop "test yieldM function" yieldM
325− prop "test die function" die
326− prop "test dieM function" dieM
471+ prop "D.fromFold FL.sum = FL.sum" fromFold
472+ prop "D.any = Prelude.any" Main.any
473+ prop "D.all = Prelude.all" Main.all
474+ prop "yield value provided" yield
475+ prop "yield monadic value provided" yieldM
476+ prop "always fail" die
477+ prop "always fail but monadic" dieM
327478
328479 describe "test for element parser" $ do
329− prop "test for peek function" peek
330− prop "test for eof function" eof
331− prop "test for satisfy function" satisfy
480+ prop "peek = head with list length > 0" peekPass
481+ prop "peek fail on []" peekFail
482+ prop "eof pass on []" eofPass
483+ prop "eof fail on non-empty list" eofFail
484+ prop "first element exists and >= mid_value" satisfyPass
485+ prop "check first element exists and satisfies predicate" satisfy
332486
333487 describe "test for sequence parser" $ do
334− prop "test for take function" Main.take
335− prop "test for takeEq function" Main.takeEQ
336− prop "test for takeGE function" Main.takeGE
337− prop "test for LookAhead function" lookAhead
338− prop "test for takeWhile function" Main.takeWhile
339− prop "test for takeWhile1 function" takeWhile1
340− prop "test for sliceSepBy function" sliceSepBy
341− -- prop "test for sliceSepByMax function" sliceSepByMax
342− prop "test for splitWith function" splitWith
343− prop "test for teeWith function" teeWith
344− prop "test for shortest function" shortest
345− prop "test for longest function" longest
346− prop "test for many function" many
347− -- prop "test for some function" some
488+ prop "D.take = Prelude.take" Main.take
489+ prop "D.takeEQ = Prelude.take when len >= n" takeEQPass
490+ prop "D.takeEQ = Prelude.take when len >= n and fail otherwise" Main.takeEQ
491+ prop "D.takeGE n ls = ls when len >= n" takeGEPass
492+ prop "D.takeGE n ls = ls when len >= n and fail otherwise" Main.takeGE
493+ prop "lookAhead . take n >> lookAhead . take n = lookAhead . take n" lookAheadPass
494+ prop "Fail when stream length exceeded" lookAheadFail
495+ prop "lookAhead . take n >> lookAhead . take n = lookAhead . take n, else fail" lookAhead
496+ prop "D.takeWhile = Prelude.takeWhile" Main.takeWhile
497+ prop "D.takeWhile = Prelude.takeWhile if taken something, else check why failed" takeWhile1
498+ prop "D.sliceSepBy = Prelude.takeWhile (not . predicate)" sliceSepBy
499+ prop "D.sliceSepByMax = Prelude.take n (Prelude.takeWhile (not . predicate)" sliceSepByMax
500+ prop "parse 0, then 1, else fail" splitWith
501+ prop "fail due to die as left parser" splitWithFailLeft
502+ prop "fail due to die as right parser" splitWithFailRight
503+ prop "fail due to die as both parsers" splitWithFailBoth
504+ prop "parsed two lists should be equal" teeWithPass
505+ prop "fail due to die as left parser" teeWithFailLeft
506+ prop "fail due to die as right parser" teeWithFailRight
507+ prop "fail due to die as both parsers" teeWithFailBoth
508+ prop "D.takeWhile (<= half_mid_value) = Prelude.takeWhile half_mid_value" shortestPass
509+ prop "pass even if die is left parser" shortestPassLeft
510+ prop "pass even if die is right parser" shortestPassRight
511+ prop "fail due to die as both parsers" shortestFailBoth
512+ prop "D.takeWhile (<= mid_value) = Prelude.takeWhile (<= mid_value)" longestPass
513+ prop "pass even if die is left parser" longestPassLeft
514+ prop "pass even if die is right parser" longestPassRight
515+ prop "fail due to die as both parsers" longestFailBoth
516+ prop "D.many concatFold $ D.sliceSepBy (== 1) FL.toList = Prelude.filter (== 0)" many
517+ prop "[] due to parser being die" many_empty
518+ -- prop "" some
519+ -- prop "fail due to parser being die" someFail