Add a test for wAsync behavior check

This commit is contained in:
Ranjeet Kumar Ranjan 2022-02-03 20:38:42 +05:30 committed by Harendra Kumar
parent ec20f5fdff
commit 4d4732577d
2 changed files with 18 additions and 0 deletions

View File

@ -47,6 +47,11 @@ main = hspec
wAsyncOps $ prop "wAsyncly consM" . constructWithConsM S.consM sort
wAsyncOps $ prop "wAsyncly (.:)" . constructWithCons (S..:)
wAsyncOps $ prop "wAsyncly (|:)" . constructWithConsM (S.|:) sort
prop "wAsync" $
constructfromWAsync
(S.fromList [1,2,3])
(S.fromList [4,5,6])
[1,4,2,5,3,6]
describe "Functor operations" $ do
wAsyncOps $ functorOps S.fromFoldable "wAsyncly" sortEq

View File

@ -31,6 +31,7 @@ module Streamly.Test.Prelude.Common
, constructWithConsM
, constructWithFromPure
, constructWithFromEffect
, constructfromWAsync
, simpleOps
-- * Applicative operations
, applicativeOps
@ -290,6 +291,18 @@ constructWithFromIndicesM op len =
streamEffect <- run $ readIORef mvl
listEquals (==) streamEffect list
constructfromWAsync ::
S.WAsyncT IO Int -> S.WAsyncT IO Int-> [Int] -> Property
constructfromWAsync s1 s2 res =
withMaxSuccess maxTestCount $
monadicIO $ do
x <- run
$ S.toList
$ S.fromWAsync
$ S.maxThreads 1
$ s1 `S.wAsync` s2
equals (==) x res
constructWithCons ::
IsStream t
=> (Int -> t IO Int -> t IO Int)