@@ -9,7 +9,6 @@ import Control.Exception
99 BlockedIndefinitelyOnSTM(..), Handler(..))
1010import Control.Monad (when, forM_, replicateM_)
1111import Data.IORef (readIORef, modifyIORef, newIORef)
12−import Data.List (sort)
1312import GHC.Word (Word8)
1413
1514import Test.Hspec.QuickCheck
@@ -20,15 +19,11 @@ import Test.QuickCheck.Monadic (monadicIO, run)
2019import Test.Hspec as H
2120
2221import Streamly
23−import Streamly as S
2422import qualified Streamly.Prelude as S
2523
2624import Streamly.Test.Common
2725import Streamly.Test.Prelude
2826
29−sortEq :: Ord a => [a] -> [a] -> Bool
30−sortEq a b = sort a == sort b
31−
3227-------------------------------------------------------------------------------
3328-- Concurrent generation
3429-------------------------------------------------------------------------------
@@ -259,10 +254,6 @@ zipAsyncMonadic constr eq t (a, b) = withMaxSuccess maxTestCount $
259254 listEquals eq stream1 list
260255 listEquals eq stream2 list
261256
262−-------------------------------------------------------------------------------
263−-- Tests for S.groupsBy
264−-------------------------------------------------------------------------------
265−
266257main :: IO ()
267258main = hspec
268259 $ H.parallel
@@ -270,34 +261,6 @@ main = hspec
270261 $ modifyMaxSuccess (const 10)
271262#endif
272263 $ do
273− let folded :: IsStream t => [a] -> t IO a
274− folded = serially . (\xs ->
275− case xs of
276− [x] -> return x -- singleton stream case
277− _ -> S.foldMapWith (<>) return xs
278− )
279−
280− let makeCommonOps :: IsStream t => (t m a -> c) -> [(String, t m a -> c)]
281− makeCommonOps t =
282− [ ("default", t)
283−#ifndef COVERAGE_BUILD
284− , ("rate AvgRate 10000", t . avgRate 10000)
285− , ("rate Nothing", t . rate Nothing)
286− , ("maxBuffer 0", t . maxBuffer 0)
287− , ("maxThreads 0", t . maxThreads 0)
288− , ("maxThreads 1", t . maxThreads 1)
289− , ("maxThreads -1", t . maxThreads (-1))
290−#endif
291− ]
292−
293− let makeOps :: IsStream t => (t m a -> c) -> [(String, t m a -> c)]
294− makeOps t = makeCommonOps t ++
295− [
296−#ifndef COVERAGE_BUILD
297− ("maxBuffer 1", t . maxBuffer 1)
298−#endif
299− ]
300−
301264 -- For concurrent application test we need a buffer of at least size 2 to
302265 -- allow two threads to run.
303266 let makeConcurrentAppOps :: IsStream t
@@ -309,19 +272,6 @@ main = hspec
309272#endif
310273 ]
311274
312− let mapOps spec = mapM_ (\(desc, f) -> describe desc $ spec f)
313− let serialOps :: IsStream t => ((SerialT IO a -> t IO a) -> Spec) -> Spec
314− serialOps spec = mapOps spec $ makeOps serially
315−#ifndef COVERAGE_BUILD
316− <> [("rate AvgRate 0.00000001", serially . avgRate 0.00000001)]
317− <> [("maxBuffer -1", serially . maxBuffer (-1))]
318−#endif
319− let wSerialOps :: IsStream t => ((WSerialT IO a -> t IO a) -> Spec) -> Spec
320− wSerialOps spec = mapOps spec $ makeOps wSerially
321−#ifndef COVERAGE_BUILD
322− <> [("rate AvgRate 0.00000001", wSerially . avgRate 0.00000001)]
323− <> [("maxBuffer (-1)", wSerially . maxBuffer (-1))]
324−#endif
325275 let asyncOps :: IsStream t => ((AsyncT IO a -> t IO a) -> Spec) -> Spec
326276 asyncOps spec = mapOps spec $ makeOps asyncly
327277#ifndef COVERAGE_BUILD
@@ -365,7 +315,6 @@ main = hspec
365315 zipAsyncOps spec = mapOps spec $ makeOps zipAsyncly
366316
367317 describe "Construction" $ do
368− wSerialOps $ prop "wSerially replicateM" . constructWithReplicateM
369318 aheadOps $ prop "aheadly replicateM" . constructWithReplicateM
370319 asyncOps $ prop "asyncly replicateM" . constructWithReplicateM
371320 wAsyncOps $ prop "wAsyncly replicateM" . constructWithReplicateM
@@ -381,8 +330,6 @@ main = hspec
381330 -- XXX add tests for fromIndices
382331
383332 describe "Functor operations" $ do
384− wSerialOps $ functorOps S.fromFoldable "wSerially" (==)
385− wSerialOps $ functorOps folded "wSerially folded" (==)
386333 aheadOps $ functorOps S.fromFoldable "aheadly" (==)
387334 aheadOps $ functorOps folded "aheadly folded" (==)
388335 asyncOps $ functorOps S.fromFoldable "asyncly" sortEq
@@ -397,7 +344,6 @@ main = hspec
397344 zipAsyncOps $ functorOps folded "zipAsyncly folded" (==)
398345
399346 describe "Semigroup operations" $ do
400− wSerialOps $ semigroupOps "wSerially" (==)
401347 aheadOps $ semigroupOps "aheadly" (==)
402348 asyncOps $ semigroupOps "asyncly" sortEq
403349 wAsyncOps $ semigroupOps "wAsyncly" sortEq
@@ -406,8 +352,6 @@ main = hspec
406352 zipAsyncOps $ semigroupOps "zipAsyncly" (==)
407353
408354 describe "Applicative operations" $ do
409− wSerialOps $ prop "wSerially applicative" . applicativeOps S.fromFoldable sortEq
410− wSerialOps $ prop "wSerially applicative folded" . applicativeOps folded sortEq
411355 aheadOps $ prop "aheadly applicative" . applicativeOps S.fromFoldable (==)
412356 aheadOps $ prop "aheadly applicative folded" . applicativeOps folded (==)
413357 asyncOps $ prop "asyncly applicative" . applicativeOps S.fromFoldable sortEq
@@ -426,8 +370,6 @@ main = hspec
426370 -- We test only the serial zip with serial streams and the parallel
427371 -- stream, because the rate setting in these streams can slow down
428372 -- zipAsync.
429− wSerialOps $ prop "zip monadic wSerially" . zipMonadic S.fromFoldable (==)
430− wSerialOps $ prop "zip monadic wSerially folded" . zipMonadic folded (==)
431373 aheadOps $ prop "zip monadic aheadly" . zipAsyncMonadic S.fromFoldable (==)
432374 aheadOps $ prop "zip monadic aheadly folded" . zipAsyncMonadic folded (==)
433375 asyncOps $ prop "zip monadic asyncly" . zipAsyncMonadic S.fromFoldable (==)
@@ -443,25 +385,21 @@ main = hspec
443385 -- describe "Merge operations" $ do
444386
445387 describe "Monad operations" $ do
446− wSerialOps $ prop "wSerially monad then" . monadThen S.fromFoldable sortEq
447388 aheadOps $ prop "aheadly monad then" . monadThen S.fromFoldable (==)
448389 asyncOps $ prop "asyncly monad then" . monadThen S.fromFoldable sortEq
449390 wAsyncOps $ prop "wAsyncly monad then" . monadThen S.fromFoldable sortEq
450391 parallelOps $ prop "parallely monad then" . monadThen S.fromFoldable sortEq
451392
452− wSerialOps $ prop "wSerially monad then folded" . monadThen folded sortEq
453393 aheadOps $ prop "aheadly monad then folded" . monadThen folded (==)
454394 asyncOps $ prop "asyncly monad then folded" . monadThen folded sortEq
455395 wAsyncOps $ prop "wAsyncly monad then folded" . monadThen folded sortEq
456396 parallelOps $ prop "parallely monad then folded" . monadThen folded sortEq
457397
458− wSerialOps $ prop "wSerially monad bind" . monadBind S.fromFoldable sortEq
459398 aheadOps $ prop "aheadly monad bind" . monadBind S.fromFoldable (==)
460399 asyncOps $ prop "asyncly monad bind" . monadBind S.fromFoldable sortEq
461400 wAsyncOps $ prop "wAsyncly monad bind" . monadBind S.fromFoldable sortEq
462401 parallelOps $ prop "parallely monad bind" . monadBind S.fromFoldable sortEq
463402
464− wSerialOps $ prop "wSerially monad bind folded" . monadBind folded sortEq
465403 aheadOps $ prop "aheadly monad bind folded" . monadBind folded (==)
466404 asyncOps $ prop "asyncly monad bind folded" . monadBind folded sortEq
467405 wAsyncOps $ prop "wAsyncly monad bind folded" . monadBind folded sortEq
@@ -493,7 +431,7 @@ main = hspec
493431 forOps (mkOps parallely) $ concurrentOps folded "parallely folded" sortEq
494432
495433 describe "Concurrent application" $ do
496− serialOps $ prop "serial" . concurrentApplication (==)
434+-- serialOps $ prop "serial" . concurrentApplication (==)
497435 asyncOps $ prop "async" . concurrentApplication sortEq
498436 aheadOps $ prop "ahead" . concurrentApplication (==)
499437 parallelConcurrentAppOps $
@@ -505,7 +443,6 @@ main = hspec
505443 concurrentFoldlApplication
506444
507445 describe "Stream transform and combine operations" $ do
508− wSerialOps $ transformCombineOpsCommon S.fromFoldable "wSerially" sortEq
509446 aheadOps $ transformCombineOpsCommon S.fromFoldable "aheadly" (==)
510447 asyncOps $ transformCombineOpsCommon S.fromFoldable "asyncly" sortEq
511448 wAsyncOps $ transformCombineOpsCommon S.fromFoldable "wAsyncly" sortEq
@@ -513,7 +450,6 @@ main = hspec
513450 zipSerialOps $ transformCombineOpsCommon S.fromFoldable "zipSerially" (==)
514451 zipAsyncOps $ transformCombineOpsCommon S.fromFoldable "zipAsyncly" (==)
515452
516− wSerialOps $ transformCombineOpsCommon folded "wSerially" sortEq
517453 aheadOps $ transformCombineOpsCommon folded "aheadly" (==)
518454 asyncOps $ transformCombineOpsCommon folded "asyncly" sortEq
519455 wAsyncOps $ transformCombineOpsCommon folded "wAsyncly" sortEq
@@ -530,7 +466,6 @@ main = hspec
530466 zipAsyncOps $ transformCombineOpsOrdered folded "zipAsyncly" (==)
531467
532468 describe "Stream elimination operations" $ do
533− wSerialOps $ eliminationOps S.fromFoldable "wSerially"
534469 aheadOps $ eliminationOps S.fromFoldable "aheadly"
535470 asyncOps $ eliminationOps S.fromFoldable "asyncly"
536471 wAsyncOps $ eliminationOps S.fromFoldable "wAsyncly"
@@ -538,7 +473,6 @@ main = hspec
538473 zipSerialOps $ eliminationOps S.fromFoldable "zipSerially"
539474 zipAsyncOps $ eliminationOps S.fromFoldable "zipAsyncly"
540475
541− wSerialOps $ eliminationOps folded "wSerially folded"
542476 aheadOps $ eliminationOps folded "aheadly folded"
543477 asyncOps $ eliminationOps folded "asyncly folded"
544478 wAsyncOps $ eliminationOps folded "wAsyncly folded"
@@ -546,7 +480,6 @@ main = hspec
546480 zipSerialOps $ eliminationOps folded "zipSerially folded"
547481 zipAsyncOps $ eliminationOps folded "zipAsyncly folded"
548482
549− wSerialOps $ eliminationOpsWord8 S.fromFoldable "wSerially"
550483 aheadOps $ eliminationOpsWord8 S.fromFoldable "aheadly"
551484 asyncOps $ eliminationOpsWord8 S.fromFoldable "asyncly"
552485 wAsyncOps $ eliminationOpsWord8 S.fromFoldable "wAsyncly"
@@ -554,7 +487,6 @@ main = hspec
554487 zipSerialOps $ eliminationOpsWord8 S.fromFoldable "zipSerially"
555488 zipAsyncOps $ eliminationOpsWord8 S.fromFoldable "zipAsyncly"
556489
557− wSerialOps $ eliminationOpsWord8 folded "wSerially folded"
558490 aheadOps $ eliminationOpsWord8 folded "aheadly folded"
559491 asyncOps $ eliminationOpsWord8 folded "asyncly folded"
560492 wAsyncOps $ eliminationOpsWord8 folded "wAsyncly folded"
@@ -565,12 +497,10 @@ main = hspec
565497 -- XXX Add a test where we chain all transformation APIs and make sure that
566498 -- the state is being passed through all of them.
567499 describe "Stream serial elimination operations" $ do
568− wSerialOps $ eliminationOpsOrdered S.fromFoldable "wSerially"
569500 aheadOps $ eliminationOpsOrdered S.fromFoldable "aheadly"
570501 zipSerialOps $ eliminationOpsOrdered S.fromFoldable "zipSerially"
571502 zipAsyncOps $ eliminationOpsOrdered S.fromFoldable "zipAsyncly"
572503
573− wSerialOps $ eliminationOpsOrdered folded "wSerially folded"
574504 aheadOps $ eliminationOpsOrdered folded "aheadly folded"
575505 zipSerialOps $ eliminationOpsOrdered folded "zipSerially folded"
576506 zipAsyncOps $ eliminationOpsOrdered folded "zipAsyncly folded"