on master help sign in
Add a test for Fold.postscan

Fix review comments Fix review comments

commit3b3bda74fba022406e1210da8ddb2e38c9d968ef authorRanjeet Kumar Ranjan <ranjeetr@composewell.com> dateThu 17 Mar 2022, 17:20 (5 years ago) parentaf68c08
1 file changed+11
test/Streamly/Test/Data/Fold.hs+11
test/Streamly/Test/Data/Fold.hs+11
@@ -519,6 +519,16 @@ unzip =
519519 let v2 = (6, ["aa", "bb", "cc"])
520520 assert (v1 == v2)
521521
522+postscan :: Property
523+postscan = forAll (listOf (chooseInt (intMin, intMax))) $ \ls ->
524+ monadicIO $ do
525+ v1 :: [Int] <-
526+ run
527+ $ S.fold (F.postscan FL.sum FL.toList)
528+ $ S.fromList ls
529+ let v2 = scanl1 (+) ls
530+ assert (v1 == v2)
531+
522532many :: Property
523533many =
524534 forAll (listOf (chooseInt (0, 100))) $ \lst ->
@@ -734,6 +744,7 @@ main = hspec $ do
734744
735745 -- Transformation
736746 prop "scan" scan
747+ prop "postscan" Main.postscan
737748 -- rsequence
738749 -- Functor instance
739750 prop "rmapM" Main.rmapM