@@ -1,5 +1,6 @@
1module Main (main) where
1module Main (main) where
3+import Control.Applicative ((<|>))
3import Control.Exception (displayException)
4import Control.Exception (displayException)
4import Data.Foldable (for_)
5import Data.Foldable (for_)
5import Data.Word (Word8, Word32, Word64)
6import Data.Word (Word8, Word32, Word64)
@@ -8,7 +9,7 @@ import Test.Hspec (Spec, hspec, describe)
8import Test.Hspec.QuickCheck
9import Test.Hspec.QuickCheck
9import Test.QuickCheck
10import Test.QuickCheck
10 (arbitrary, forAll, elements, Property, property, listOf,
11 (arbitrary, forAll, elements, Property, property, listOf,
11− vectorOf, Gen)
12+ vectorOf, Gen, (.&&.))
12import Test.QuickCheck.Monadic (monadicIO, assert, run)
13import Test.QuickCheck.Monadic (monadicIO, assert, run)
14import Prelude hiding (sequence)
15import Prelude hiding (sequence)
@@ -16,10 +17,13 @@ import Prelude hiding (sequence)
16import qualified Control.Monad.Fail as Fail
17import qualified Control.Monad.Fail as Fail
17import qualified Data.List as List
18import qualified Data.List as List
18import qualified Prelude
19import qualified Prelude
20+import qualified Streamly.Data.Stream as S
19import qualified Streamly.Internal.Data.Array as A
21import qualified Streamly.Internal.Data.Array as A
20import qualified Streamly.Internal.Data.Fold as FL
22import qualified Streamly.Internal.Data.Fold as FL
21import qualified Streamly.Internal.Data.Parser as P
23import qualified Streamly.Internal.Data.Parser as P
22−import qualified Streamly.Internal.Data.Stream as S
24+import qualified Streamly.Internal.Data.Producer.Source as Source
25+import qualified Streamly.Internal.Data.Producer as Producer
26+import qualified Streamly.Internal.Data.Unfold as Unfold
23import qualified Test.Hspec as H
27import qualified Test.Hspec as H
25#if MIN_VERSION_QuickCheck(2,14,0)
29#if MIN_VERSION_QuickCheck(2,14,0)
@@ -213,6 +217,13 @@ takeBetween =
213 Left _ ->
217 Left _ ->
214 property ((m >= 0 && n >= 0 && m > n) || inputLen < m)
218 property ((m >= 0 && n >= 0 && m > n) || inputLen < m)
222+ forAll (chooseInt (min_value, max_value)) $ \n ->
223+ forAll (listOf (chooseInt (min_value, max_value))) $ \ls ->
224+ case runIdentity $ S.parse (P.fromFold $ FL.take n FL.toList) (S.fromList ls) of
225+ Right parsed_list -> checkListEqual parsed_list (Prelude.take n ls)
226+ Left _ -> property False
217takeEQPass :: Property
228takeEQPass :: Property
218takeEQPass =
229takeEQPass =
@@ -263,7 +274,6 @@ takeGE =
263 else property False
274 else property False
264 Left _ -> property (n > list_length)
275 Left _ -> property (n > list_length)
267nLessThanEqual0 ::
277nLessThanEqual0 ::
269 -> FL.Fold Identity Int [Int]
279 -> FL.Fold Identity Int [Int]
@@ -286,21 +296,23 @@ takeProperties =
286 prop "takeGE n FL.toList xs = xs" $
296 prop "takeGE n FL.toList xs = xs" $
287 nLessThanEqual0 P.takeGE (\_ -> id)
297 nLessThanEqual0 P.takeGE (\_ -> id)
299+-- XXX lookAhead can't deal with EOF which in this case means when
300+-- n==list_length, this test will fail. So excluding that case for now.
289−-- lookAheadPass :: Property
301+lookAheadPass :: Property
290−-- lookAheadPass =
302+lookAheadPass =
291−-- forAll (chooseInt (min_value + 1, max_value)) $ \n ->
303+ forAll (chooseInt (min_value, max_value)) $ \n ->
293−-- takeWithoutConsume = P.lookAhead $ P.take n FL.toList
305+ takeWithoutConsume = P.lookAhead $ P.fromFold $ FL.take n FL.toList
294−-- parseTwice = do
306+ parseTwice = do
295−-- parsed_list_1 <- takeWithoutConsume
307+ parsed_list_1 <- takeWithoutConsume
296−-- parsed_list_2 <- takeWithoutConsume
308+ parsed_list_2 <- takeWithoutConsume
297−-- return (parsed_list_1, parsed_list_2)
309+ return (parsed_list_1, parsed_list_2)
299−-- forAll (chooseInt (n, max_value)) $ \list_length ->
311+ forAll (chooseInt (n+1, max_value)) $ \list_length ->
300−-- forAll (vectorOf list_length (chooseInt (min_value, max_value))) $ \ls ->
312+ forAll (vectorOf list_length (chooseInt (min_value, max_value))) $ \ls ->
301−-- case S.parse parseTwice (S.fromList ls) of
313+ case runIdentity $ S.parse parseTwice (S.fromList ls) of
302−-- Right (ls_1, ls_2) -> checkListEqual ls_1 ls_2 .&&. checkListEqual ls_1 (Prelude.take n ls)
314+ Right (ls_1, ls_2) -> checkListEqual ls_1 ls_2 .&&. checkListEqual ls_1 (Prelude.take n ls)
303−-- Left _ -> property $ False
315+ Left _ -> property $ False
305-- lookAheadFail :: Property
317-- lookAheadFail :: Property
306-- lookAheadFail =
318-- lookAheadFail =
@@ -318,22 +330,22 @@ takeProperties =
318-- Right _ -> False
330-- Right _ -> False
319-- Left _ -> True
331-- Left _ -> True
321−-- lookAhead :: Property
333+lookAhead :: Property
322−-- lookAhead =
334+lookAhead =
323−-- forAll (chooseInt (min_value, max_value)) $ \n ->
335+ forAll (chooseInt (min_value, max_value)) $ \n ->
325−-- takeWithoutConsume = P.lookAhead $ P.take n FL.toList
337+ takeWithoutConsume = P.lookAhead $ P.fromFold $ FL.take n FL.toList
326−-- parseTwice = do
338+ parseTwice = do
327−-- parsed_list_1 <- takeWithoutConsume
339+ parsed_list_1 <- takeWithoutConsume
328−-- parsed_list_2 <- takeWithoutConsume
340+ parsed_list_2 <- takeWithoutConsume
329−-- return (parsed_list_1, parsed_list_2)
341+ return (parsed_list_1, parsed_list_2)
331−-- forAll (listOf (chooseInt (min_value, max_value))) $ \ls ->
343+ forAll (listOf (chooseInt (min_value, max_value))) $ \ls ->
332−-- case S.parse parseTwice (S.fromList ls) of
344+ case runIdentity $ S.parse parseTwice (S.fromList ls) of
333−-- Right (ls_1, ls_2) -> checkListEqual ls_1 ls_2 .&&. checkListEqual ls_1 (Prelude.take n ls)
345+ Right (ls_1, ls_2) -> checkListEqual ls_1 ls_2 .&&. checkListEqual ls_1 (Prelude.take n ls)
334−-- Left _ -> property ((list_length < n) || (list_length == n && n == 0))
346+ Left _ -> property ((list_length < n) || (list_length == n && n == 0))
336−-- list_length = Prelude.length ls
348+ list_length = Prelude.length ls
338takeEndBy_ :: Property
350takeEndBy_ :: Property
339takeEndBy_ =
351takeEndBy_ =
@@ -347,6 +359,16 @@ takeEndBy_ =
347 prsr = P.many (P.satisfy (const True)) FL.toList
359 prsr = P.many (P.satisfy (const True)) FL.toList
348 tkwhl ls = Prelude.takeWhile (not . predicate) ls
360 tkwhl ls = Prelude.takeWhile (not . predicate) ls
362+takeEndByOrMax_ :: Property
364+ forAll (chooseInt (min_value, max_value)) $ \n ->
365+ forAll (listOf (chooseInt (0, 1))) $ \ls ->
366+ case runIdentity $ S.parse (P.fromFold $ FL.takeEndBy_ predicate (FL.take n FL.toList)) (S.fromList ls) of
367+ Right parsed_list -> checkListEqual parsed_list (Prelude.take n (Prelude.takeWhile (not . predicate) ls))
368+ Left _ -> property False
350takeStartBy :: Property
372takeStartBy :: Property
351takeStartBy =
373takeStartBy =
352 forAll (listOf (chooseInt (min_value, max_value))) $ \ls ->
374 forAll (listOf (chooseInt (min_value, max_value))) $ \ls ->
@@ -464,6 +486,25 @@ groupBy =
464 | null lst = []
486 | null lst = []
465 | otherwise = head $ List.groupBy cmp lst
487 | otherwise = head $ List.groupBy cmp lst
489+groupByRolling :: Property
491+ forAll (listOf (chooseInt (0, 1)))
493+ case runIdentity $ S.parse parser (S.fromList ls) of
494+ Right parsed -> checkListEqual parsed (groupByLF Nothing ls)
495+ Left _ -> property False
500+ parser = P.groupBy cmp FL.toList
502+ groupByLF Nothing (x:xs) = x : groupByLF (Just x) xs
503+ groupByLF (Just y) (x:xs) =
505+ then x : groupByLF (Just x) xs
467wordBy :: Property
508wordBy :: Property
469 forAll (listOf (elements [' ', 's']))
510 forAll (listOf (elements [' ', 's']))
@@ -530,42 +571,41 @@ parseManyWordQuotedBy =
530 , ["The qui[ck] brown", "fox"])
571 , ["The qui[ck] brown", "fox"])
574+splitWith :: Property
576+ forAll (listOf (chooseInt (0, 1))) $ \ls ->
577+ case runIdentity $ S.parse (P.splitWith (,) (P.satisfy (== 0)) (P.satisfy (== 1))) (S.fromList ls) of
578+ Right (result_first, result_second) -> case ls of
579+ 0 : 1 : _ -> (result_first == 0) && (result_second == 1)
581+ Left _ -> case ls of
534−-- splitWithPass :: Property
536−-- forAll (listOf (chooseInt (0, 1))) $ \ls ->
537−-- case S.parse (P.splitWith (,) (P.satisfy (== 0)) (P.satisfy (== 1))) (S.fromList ls) of
538−-- Right (result_first, result_second) -> case ls of
539−-- 0 : 1 : _ -> (result_first == 0) && (result_second == 1)
541−-- Left _ -> case ls of
542−-- 0 : 1 : _ -> False
545−-- splitWithFailLeft :: Property
585+splitWithFailLeft :: Property
546−-- splitWithFailLeft =
586+splitWithFailLeft =
547−-- property (case S.parse (P.splitWith (,) (P.die "die") (P.fromPure (1 :: Int))) (S.fromList [1 :: Int]) of
587+ property (case runIdentity $ S.parse (P.splitWith (,) (P.die "die") (P.fromPure (1 :: Int))) (S.fromList [1 :: Int]) of
548−-- Right _ -> False
588+ Right _ -> False
549−-- Left _ -> True)
589+ Left _ -> True)
551−-- splitWithFailRight :: Property
591+splitWithFailRight :: Property
552−-- splitWithFailRight =
592+splitWithFailRight =
553−-- property (case S.parse (P.splitWith (,) (P.fromPure (1 :: Int)) (P.die "die")) (S.fromList [1 :: Int]) of
593+ property (case runIdentity $ S.parse (P.splitWith (,) (P.fromPure (1 :: Int)) (P.die "die")) (S.fromList [1 :: Int]) of
554−-- Right _ -> False
594+ Right _ -> False
555−-- Left _ -> True)
595+ Left _ -> True)
557−-- splitWithFailBoth :: Property
597+splitWithFailBoth :: Property
558−-- splitWithFailBoth =
598+splitWithFailBoth =
559−-- property (case S.parse (P.splitWith (,) (P.die "die") (P.die "die")) (S.fromList [1 :: Int]) of
599+ property (case runIdentity $ S.parse (P.splitWith (,) (P.die "die") (P.die "die")) (S.fromList [1 :: Int]) of
560−-- Right _ -> False
600+ Right _ -> False
561−-- Left _ -> True)
601+ Left _ -> True)
563-- teeWithPass :: Property
603-- teeWithPass :: Property
564-- teeWithPass =
604-- teeWithPass =
565−-- forAll (chooseInt (0, 10000)) $ \n ->
605+-- forAll (chooseInt (min_value, max_value)) $ \n ->
566-- forAll (listOf (chooseInt (0, 1))) $ \ls ->
606-- forAll (listOf (chooseInt (0, 1))) $ \ls ->
568−-- prsr = P.take n FL.toList
608+-- prsr = P.fromFold $ FL.take n FL.toList
570-- case S.parse (P.teeWith (,) prsr prsr) (S.fromList ls) of
610-- case S.parse (P.teeWith (,) prsr prsr) (S.fromList ls) of
571-- Right (ls_1, ls_2) -> checkListEqual (Prelude.take n ls) ls_1 .&&. checkListEqual ls_1 ls_2
611-- Right (ls_1, ls_2) -> checkListEqual (Prelude.take n ls) ls_1 .&&. checkListEqual ls_1 ls_2
@@ -610,50 +650,86 @@ deintercalate =
610-- shortestPass =
650-- shortestPass =
611-- forAll (listOf (chooseInt(min_value, max_value))) $ \ls ->
651-- forAll (listOf (chooseInt(min_value, max_value))) $ \ls ->
653+-- half_mid_value = mid_value `Prelude.div` 2
613−-- prsr_1 = P.takeWhile (<= (mid_value `Prelude.div` 2)) FL.toList
654+-- prsr_1 = P.takeWhile (<= half_mid_value) FL.toList
614-- prsr_2 = P.takeWhile (<= mid_value) FL.toList
655-- prsr_2 = P.takeWhile (<= mid_value) FL.toList
615-- prsr_shortest = P.shortest prsr_1 prsr_2
656-- prsr_shortest = P.shortest prsr_1 prsr_2
617-- case S.parse prsr_shortest (S.fromList ls) of
658-- case S.parse prsr_shortest (S.fromList ls) of
618−-- Right short_list -> checkListEqual short_list (Prelude.takeWhile (<= 2500) ls)
659+-- Right short_list -> checkListEqual short_list (Prelude.takeWhile (<= half_mid_value) ls)
619-- Left _ -> property False
660-- Left _ -> property False
621−-- shortestFailLeft :: Property
662+-- shortestPassLeft :: Property
622−-- shortestFailLeft =
663+-- shortestPassLeft =
623-- property (case S.parse (P.shortest (P.die "die") (P.fromPure (1 :: Int))) (S.fromList [1 :: Int]) of
664-- property (case S.parse (P.shortest (P.die "die") (P.fromPure (1 :: Int))) (S.fromList [1 :: Int]) of
624-- Right r -> r == 1
665-- Right r -> r == 1
625-- Left _ -> False)
666-- Left _ -> False)
627−-- shortestFailRight :: Property
668+-- shortestPassRight :: Property
628−-- shortestFailRight =
669+-- shortestPassRight =
629-- property (case S.parse (P.shortest (P.fromPure (1 :: Int)) (P.die "die")) (S.fromList [1 :: Int]) of
670-- property (case S.parse (P.shortest (P.fromPure (1 :: Int)) (P.die "die")) (S.fromList [1 :: Int]) of
630-- Right r -> r == 1
671-- Right r -> r == 1
631-- Left _ -> False)
672-- Left _ -> False)
633-- shortestFailBoth :: Property
674-- shortestFailBoth :: Property
634-- shortestFailBoth =
675-- shortestFailBoth =
678+-- (P.shortest (P.die "die") (P.die "die"))
679+-- (S.fromList [1 :: Int]) of
683+-- longestPass :: Property
685+-- forAll (listOf (chooseInt(min_value, max_value))) $ \ls ->
687+-- half_mid_value = mid_value `Prelude.div` 2
688+-- prsr_1 = P.takeWhile (<= half_mid_value) FL.toList
689+-- prsr_2 = P.takeWhile (<= mid_value) FL.toList
690+-- prsr_longest = P.longest prsr_1 prsr_2
692+-- case S.parse prsr_longest (S.fromList ls) of
693+-- Right long_list -> long_list == Prelude.takeWhile (<= mid_value) ls
696+-- longestPassLeft :: Property
698+-- property (case S.parse (P.shortest (P.die "die") (P.fromPure (1 :: Int))) (S.fromList [1 :: Int]) of
702+-- longestPassRight :: Property
703+-- longestPassRight =
704+-- property (case S.parse (P.shortest (P.fromPure (1 :: Int)) (P.die "die")) (S.fromList [1 :: Int]) of
708+-- longestFailBoth :: Property
635−-- property (case S.parse (P.shortest (P.die "die") (P.die "die")) (S.fromList [1 :: Int]) of
711+-- (case S.parse (P.shortest (P.die "die") (P.die "die")) (S.fromList [1 :: Int]) of
636-- Right _ -> False
712-- Right _ -> False
637-- Left _ -> True)
713-- Left _ -> True)
639many :: Property
715many :: Property
641 forAll (listOf (chooseInt (0, 1))) $ \ls ->
717 forAll (listOf (chooseInt (0, 1))) $ \ls ->
642− let fldstp conL currL = return $ FL.Partial $ conL ++ currL
718+ let fldstp conL currL = return $ FL.Partial (conL ++ currL)
643 concatFold = FL.Fold fldstp (return (FL.Partial [])) return
719 concatFold = FL.Fold fldstp (return (FL.Partial [])) return
721+ flip P.many concatFold
645− flip P.many concatFold $ P.fromFold $ FL.takeEndBy_ (== 1) FL.toList
722+ $ P.fromFold $ FL.takeEndBy_ (== 1) FL.toList
647− case runIdentity $ S.parse prsr (S.fromList ls) of
723+ in case runIdentity $ S.parse prsr (S.fromList ls) of
648− Right res_list -> checkListEqual res_list
725+ checkListEqual res_list (Prelude.filter (== 0) ls)
649− $ Prelude.filter (== 0) ls
650 Left _ -> property False
726 Left _ -> property False
652−-- many_empty :: Property
728+many_empty :: Property
653−-- many_empty =
729+many_empty =
654−-- property (case S.parse (P.many FL.toList (P.die "die")) (S.fromList [1 :: Int]) of
730+ property (case runIdentity $ S.parse (flip P.many FL.toList (P.die "die")) (S.fromList [1 :: Int]) of
655−-- Right res_list -> checkListEqual res_list ([] :: [Int])
731+ Right res_list -> checkListEqual res_list ([] :: [Int])
656−-- Left _ -> property False)
732+ Left _ -> property False)
658some :: Property
734some :: Property
@@ -663,17 +739,17 @@ some =
663 fldstp conL currL = return $ FL.Partial $ conL ++ currL
739 fldstp conL currL = return $ FL.Partial $ conL ++ currL
664 concatFold = FL.Fold fldstp (return (FL.Partial [])) return
740 concatFold = FL.Fold fldstp (return (FL.Partial [])) return
742+ flip P.some concatFold
666− flip P.some concatFold $ P.fromFold $ FL.takeEndBy_ (== 1) FL.toList
743+ $ P.fromFold $ FL.takeEndBy_ (== 1) FL.toList
668− case runIdentity $ S.parse prsr (S.fromList ls) of
744+ in case runIdentity $ S.parse prsr (S.fromList ls) of
669 Right res_list -> res_list == Prelude.filter (== 0) ls
745 Right res_list -> res_list == Prelude.filter (== 0) ls
670 Left _ -> False
746 Left _ -> False
672−-- someFail :: Property
748+someFail :: Property
673−-- someFail =
749+someFail =
674−-- property (case S.parse (P.some FL.toList (P.die "die")) (S.fromList [1 :: Int]) of
750+ property (case runIdentity $ S.parse (P.some (P.die "die") FL.toList) (S.fromList [1 :: Int]) of
675−-- Right _ -> False
751+ Right _ -> False
676−-- Left _ -> True)
752+ Left _ -> True)
678-------------------------------------------------------------------------------
754-------------------------------------------------------------------------------
679-- Instances
755-- Instances
@@ -687,12 +763,10 @@ applicative =
688 <$> P.fromFold (FL.take (length list1) FL.toList)
764 <$> P.fromFold (FL.take (length list1) FL.toList)
689 <*> P.fromFold (FL.take (length list2) FL.toList)
765 <*> P.fromFold (FL.take (length list2) FL.toList)
690− in monadicIO $ do
766+ in
691− s <- S.parse parser (S.fromList $ list1 ++ list2)
767+ case runIdentity $ S.parse parser (S.fromList $ list1 ++ list2) of
694− Right (olist1, olist2) -> olist1 == list1 && olist2 == list2
768+ Right (olist1, olist2) -> olist1 == list1 && olist2 == list2
695− Left _ -> False
769+ Left _ -> False
697sequence :: Property
771sequence :: Property
698sequence =
772sequence =
@@ -708,6 +782,28 @@ sequence =
708 Right ls -> ls == ins
782 Right ls -> ls == ins
709 Left _ -> False
783 Left _ -> False
789+ (P.satisfy (> 0) <|> return 66)
790+ (S.fromList ([]::[Int]))
800+ ((P.takeEQ 2 FL.toList) <|> (P.takeEQ 1 FL.toList))
801+ (S.fromList ([51]::[Int]))
804+ Right x -> x == [51]
711monad :: Property
807monad :: Property
713 forAll (listOf (chooseAny :: Gen Int)) $ \ list1 ->
809 forAll (listOf (chooseAny :: Gen Int)) $ \ list1 ->
@@ -740,6 +836,49 @@ parseMany =
740 $ S.parseMany p (S.fromList $ concat ins)
836 $ S.parseMany p (S.fromList $ concat ins)
741 listEquals (==) outs ins
837 listEquals (==) outs ins
839+-- basic sanity test for parsing from arrays
840+parseUnfold :: Property
843+ -- ls = input list (stream)
844+ -- clen = chunk size
845+ -- tlen = parser take size
848+ <$> vectorOf len (chooseAny :: Gen Int)
849+ <*> chooseInt (1, len)
850+ <*> chooseInt (1, len)) $ \(ls, clen, tlen) ->
852+ arrays <- S.toList $ S.chunksOf clen (S.fromList ls)
853+ let src = Source.source (Just (Producer.OuterLoop arrays))
854+ let parser = P.fromFold (FL.take tlen FL.toList)
857+ $ Producer.concat Producer.fromList A.producer
859+ Producer.simplify (Source.parseManyD parser readSrc)
862+ $ S.unfoldMany Unfold.fromList
864+ $ S.unfold streamParser src
866+ listEquals (==) xs ls
868+parserSequence :: Property
870+ forAll (vectorOf 11 (listOf (chooseAny :: Gen Int))) $ \ins ->
872+ let parsers = S.fromList
873+ $ fmap (\xs -> P.fromFold $ FL.take (length xs) FL.sum) ins
874+ let sequencedParser = P.sequence parsers FL.sum
876+ S.parse sequencedParser $ S.concatMap S.fromList (S.fromList ins)
879+ Right x -> x == sum (map sum ins)
743-------------------------------------------------------------------------------
882-------------------------------------------------------------------------------
744-- Test for a particular case hit during fs events testing
883-- Test for a particular case hit during fs events testing
745-------------------------------------------------------------------------------
884-------------------------------------------------------------------------------
@@ -1145,11 +1284,15 @@ main =
1146 describe "Instances" $ do
1285 describe "Instances" $ do
1147 prop "applicative" applicative
1286 prop "applicative" applicative
1287+ prop "Alternative: end of input 1" altEOF1
1288+ prop "Alternative: end of input 2" altEOF2
1148 prop "monad" monad
1289 prop "monad" monad
1149 prop "sequence" sequence
1290 prop "sequence" sequence
1150 describe "Stream parsing" $ do
1291 describe "Stream parsing" $ do
1151 prop "parseMany" parseMany
1292 prop "parseMany" parseMany
1152 prop "parseMany2Events" parseMany2Events
1293 prop "parseMany2Events" parseMany2Events
1294+ prop "parseUnfold" parseUnfold
1295+ prop "parserSequence" parserSequence
1154 describe "test for accumulator" $ do
1297 describe "test for accumulator" $ do
1155 prop "P.fromFold FL.sum = FL.sum" fromFold
1298 prop "P.fromFold FL.sum = FL.sum" fromFold
@@ -1174,16 +1317,15 @@ main =
1174 takeBetweenPass
1317 takeBetweenPass
1175 prop ("P.takeBetween = Prelude.take when len >= m and len <= n and fail"
1318 prop ("P.takeBetween = Prelude.take when len >= m and len <= n and fail"
1176 ++ "otherwise fail") Main.takeBetween
1319 ++ "otherwise fail") Main.takeBetween
1177−
1320+ prop "P.take = Prelude.take" Main.take
1178 prop "P.takeEQ = Prelude.take when len >= n" takeEQPass
1321 prop "P.takeEQ = Prelude.take when len >= n" takeEQPass
1179 prop "P.takeEQ = Prelude.take when len >= n and fail otherwise"
1322 prop "P.takeEQ = Prelude.take when len >= n and fail otherwise"
1180 Main.takeEQ
1323 Main.takeEQ
1181 prop "P.takeGE n ls = ls when len >= n" takeGEPass
1324 prop "P.takeGE n ls = ls when len >= n" takeGEPass
1182 prop "P.takeGE n ls = ls when len >= n and fail otherwise" Main.takeGE
1325 prop "P.takeGE n ls = ls when len >= n and fail otherwise" Main.takeGE
1183− -- prop "lookAhead . take n >> lookAhead . take n = lookAhead . take n" lookAheadPass
1326+ prop "lookAhead . take n >> lookAhead . take n = lookAhead . take n" lookAheadPass
1184 -- prop "Fail when stream length exceeded" lookAheadFail
1327 -- prop "Fail when stream length exceeded" lookAheadFail
1185− -- prop "lookAhead . take n >> lookAhead . take n = lookAhead . take n, else fail" lookAhead
1328+ prop "lookAhead . take n >> lookAhead . take n = lookAhead . take n, else fail" lookAhead
1186− prop "P.takeEndBy_ test" Main.takeEndBy_
1187 prop ("P.takeStartBy pred = head : Prelude.takeWhile (not . pred)"
1329 prop ("P.takeStartBy pred = head : Prelude.takeWhile (not . pred)"
1188 ++ " tail") takeStartBy
1330 ++ " tail") takeStartBy
1189 prop "P.takeWhile = Prelude.takeWhile" Main.takeWhile
1331 prop "P.takeWhile = Prelude.takeWhile" Main.takeWhile
@@ -1192,13 +1334,14 @@ main =
1192 prop "takeWhileP prd P.take = takeWhileMaxLen prd" takeWhileP
1334 prop "takeWhileP prd P.take = takeWhileMaxLen prd" takeWhileP
1193 prop ("P.takeP = Prelude.take") takeP
1335 prop ("P.takeP = Prelude.take") takeP
1194 prop "P.groupBy = Prelude.head . Prelude.groupBy" groupBy
1336 prop "P.groupBy = Prelude.head . Prelude.groupBy" groupBy
1337+ prop "groupByRolling" groupByRolling
1195 prop "many (P.wordBy ' ') = words'" wordBy
1338 prop "many (P.wordBy ' ') = words'" wordBy
1196 parseManyWordQuotedBy
1339 parseManyWordQuotedBy
1197 -- prop "choice" choice
1340 -- prop "choice" choice
1198− -- prop "" splitWithPass
1341+ prop "parse 0, then 1, else fail" splitWith
1199− -- prop "" splitWithFailLeft
1342+ prop "fail due to die as left parser" splitWithFailLeft
1200− -- prop "" splitWithFailRight
1343+ prop "fail due to die as right parser" splitWithFailRight
1201− -- prop "" splitWithFailBoth
1344+ prop "fail due to die as both parsers" splitWithFailBoth
1202 -- prop "" teeWithPass
1345 -- prop "" teeWithPass
1203 -- prop "" teeWithFailLeft
1346 -- prop "" teeWithFailLeft
1204 -- prop "" teeWithFailRight
1347 -- prop "" teeWithFailRight
@@ -1210,13 +1353,14 @@ main =
1210 -- prop "" shortestFailBoth
1353 -- prop "" shortestFailBoth
1211 prop ("P.many concatFold $ P.takeEndBy_ (== 1) FL.toList ="
1354 prop ("P.many concatFold $ P.takeEndBy_ (== 1) FL.toList ="
1212 ++ "Prelude.filter (== 0)") many
1355 ++ "Prelude.filter (== 0)") many
1213− -- prop "[] due to parser being die" many_empty
1356+ prop "[] due to parser being die" many_empty
1214 prop ("P.some concatFold $ P.takeEndBy_ (== 1) FL.toList ="
1357 prop ("P.some concatFold $ P.takeEndBy_ (== 1) FL.toList ="
1215 ++ "Prelude.filter (== 0)") some
1358 ++ "Prelude.filter (== 0)") some
1216− -- prop "fail due to parser being die" someFail
1359+ prop "fail due to parser being die" someFail
1217 prop "P.many == S.parseMany" manyEqParseMany
1360 prop "P.many == S.parseMany" manyEqParseMany
1219 prop "takeEndBy_" takeEndBy_
1362 prop "takeEndBy_" takeEndBy_
1363+ prop "takeEndByOrMax_" takeEndByOrMax_
1220 prop "takeEndBy1" takeEndBy1
1364 prop "takeEndBy1" takeEndBy1
1221 prop "takeEndBy2" takeEndBy2
1365 prop "takeEndBy2" takeEndBy2
1222 prop "takeEndByEsc" takeEndByEsc
1366 prop "takeEndByEsc" takeEndByEsc