@@ -10,11 +10,12 @@ import Test.QuickCheck
10 property, listOf, vectorOf, (.&&.), Gen, suchThat)
10 property, listOf, vectorOf, (.&&.), Gen, suchThat)
11import Test.QuickCheck.Monadic (monadicIO, assert, run)
11import Test.QuickCheck.Monadic (monadicIO, assert, run)
13+import qualified Data.List as List
14+import qualified Prelude
15+import qualified Streamly.Internal.Data.Array.Storable.Foreign as A
16+import qualified Streamly.Internal.Data.Fold as FL
13import qualified Streamly.Internal.Data.Parser.ParserD as P
17import qualified Streamly.Internal.Data.Parser.ParserD as P
14import qualified Streamly.Internal.Data.Stream.IsStream as S
18import qualified Streamly.Internal.Data.Stream.IsStream as S
15−import qualified Streamly.Internal.Data.Fold as FL
16−import qualified Streamly.Internal.Data.Array.Storable.Foreign as A
17−import qualified Prelude
18import qualified Test.Hspec as H
19import qualified Test.Hspec as H
20import Prelude hiding (sequence)
21import Prelude hiding (sequence)
@@ -287,6 +288,22 @@ takeWhile1 =
288 predicate = (== 0)
289 predicate = (== 0)
293+ forAll (listOf (chooseInt (0, 1)))
295+ case S.parseD parser (S.fromList ls) of
296+ Right parsed -> checkListEqual parsed (groupByLF ls)
297+ Left _ -> property False
302+ parser = P.groupBy cmp FL.toList
305+ | otherwise = head $ List.groupBy cmp lst
290sliceSepBy :: Property
307sliceSepBy :: Property
291sliceSepBy =
308sliceSepBy =
292 forAll (listOf (chooseInt (0, 1))) $ \ls ->
309 forAll (listOf (chooseInt (0, 1))) $ \ls ->
@@ -637,6 +654,7 @@ main =
637 prop "lookAhead . take n >> lookAhead . take n = lookAhead . take n, else fail" lookAhead
654 prop "lookAhead . take n >> lookAhead . take n = lookAhead . take n, else fail" lookAhead
638 prop "P.takeWhile = Prelude.takeWhile" Main.takeWhile
655 prop "P.takeWhile = Prelude.takeWhile" Main.takeWhile
639 prop "P.takeWhile1 = Prelude.takeWhile if taken something, else check why failed" takeWhile1
656 prop "P.takeWhile1 = Prelude.takeWhile if taken something, else check why failed" takeWhile1
657+ prop "P.groupBy = Prelude.head . Prelude.groupBy" groupBy
640 prop "P.sliceSepBy = Prelude.takeWhile (not . predicate)" sliceSepBy
658 prop "P.sliceSepBy = Prelude.takeWhile (not . predicate)" sliceSepBy
641 prop "P.sliceSepByMax = Prelude.take n (Prelude.takeWhile (not . predicate)" sliceSepByMax
659 prop "P.sliceSepByMax = Prelude.take n (Prelude.takeWhile (not . predicate)" sliceSepByMax
642 prop "parse 0, then 1, else fail" splitWith
660 prop "parse 0, then 1, else fail" splitWith