mirror of
https://github.com/ilyakooo0/streamly.git
synced 2024-10-26 01:48:03 +03:00
Add a test for wAsync behavior check
This commit is contained in:
parent
ec20f5fdff
commit
4d4732577d
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user