on master help sign in
Add test case for Fold.scan
e0cf3aaRanjeet Kumar Ranjan
test/Streamly/Test/Data/Fold.hs+11
@@ -666,6 +666,16 @@ splitAt =
666 `shouldReturn`
666 `shouldReturn`
667 ("Hello ","World!")
667 ("Hello ","World!")
668
668
669+scan :: Property
670+scan = forAll (listOf (chooseInt (0, 100))) $ \lst ->
671+ monadicIO $ do
672+ v1 :: [Int] <-
673+ run
674+ $ S.fold (F.scan FL.sum FL.toList)
675+ $ S.fromList lst
676+ let v2 = scanl (+) 0 lst
677+ assert (v1 == v2)
678+
669moduleName :: String
679moduleName :: String
670moduleName = "Data.Fold"
680moduleName = "Data.Fold"
671
681
@@ -723,6 +733,7 @@ main = hspec $ do
723 -- Combinators
733 -- Combinators
724
734
725 -- Transformation
735 -- Transformation
736+ prop "scan" scan
726 -- rsequence
737 -- rsequence
727 -- Functor instance
738 -- Functor instance
728 prop "rmapM" Main.rmapM
739 prop "rmapM" Main.rmapM