on master help sign in
Add test case for Fold.scan
commite0cf3aa3cf4bfeb7fd4deb5a3c1ae95db760e759 authorRanjeet Kumar Ranjan <ranjeetr@composewell.com> dateThu 17 Mar 2022, 18:11 (5 years ago) parent6726613
1 file changed+11
test/Streamly/Test/Data/Fold.hs+11
test/Streamly/Test/Data/Fold.hs+11
@@ -666,6 +666,16 @@ splitAt =
666666 `shouldReturn`
667667 ("Hello ","World!")
668668
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+
669679moduleName :: String
670680moduleName = "Data.Fold"
671681
@@ -723,6 +733,7 @@ main = hspec $ do
723733 -- Combinators
724734
725735 -- Transformation
736+ prop "scan" scan
726737 -- rsequence
727738 -- Functor instance
728739 prop "rmapM" Main.rmapM