on master help sign in
Add a test for Fold.postscan
3b3bda7Ranjeet Kumar Ranjan
test/Streamly/Test/Data/Fold.hs+11
@@ -519,6 +519,16 @@ unzip =
519 let v2 = (6, ["aa", "bb", "cc"])
519 let v2 = (6, ["aa", "bb", "cc"])
520 assert (v1 == v2)
520 assert (v1 == v2)
521
521
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+
522many :: Property
532many :: Property
523many =
533many =
524 forAll (listOf (chooseInt (0, 100))) $ \lst ->
534 forAll (listOf (chooseInt (0, 100))) $ \lst ->
@@ -734,6 +744,7 @@ main = hspec $ do
734
744
735 -- Transformation
745 -- Transformation
736 prop "scan" scan
746 prop "scan" scan
747+ prop "postscan" Main.postscan
737 -- rsequence
748 -- rsequence
738 -- Functor instance
749 -- Functor instance
739 prop "rmapM" Main.rmapM
750 prop "rmapM" Main.rmapM