@@ -35,9 +35,6 @@ toListInterleaved = S.toList . wSerially
3535toListAsync :: AsyncT IO a -> IO [a]
3636toListAsync = S.toList . asyncly
3737
38−toListParallel :: WAsyncT IO a -> IO [a]
39−toListParallel = S.toList . wAsyncly
40−
4138main :: IO ()
4239main = hspec $ do
4340 parallelTests
@@ -189,36 +186,6 @@ testFoldOpsCleanup name f = do
189186
190187parallelTests :: SpecWith ()
191188parallelTests = H.parallel $ do
192− describe "Runners" $ do
193− -- XXX move these to property tests
194− -- XXX use an IORef to store and check the side effects
195− it "simple serially" $
196− (S.drain . serially) (return (0 :: Int)) `shouldReturn` ()
197− it "simple serially with IO" $
198− (S.drain . serially) (S.yieldM $ putStrLn "hello") `shouldReturn` ()
199−
200− describe "Empty" $ -- do
201− it "Monoid - mempty" $
202− toListSerial mempty `shouldReturn` ([] :: [Int])
203− -- it "Alternative - empty" $
204− -- (toListSerial empty) `shouldReturn` ([] :: [Int])
205− -- it "MonadPlus - mzero" $
206− -- (toListSerial mzero) `shouldReturn` ([] :: [Int])
207−
208−
209− ---------------------------------------------------------------------------
210− -- Monoidal Compositions, multiset equality checks
211− ---------------------------------------------------------------------------
212−
213− describe "Serial Composition" $ compose serially mempty id
214− describe "Ahead Composition" $ compose aheadly mempty id
215− describe "WSerial Composition" $ compose wSerially mempty sort
216− describe "Async Composition" $ compose asyncly mempty sort
217− describe "WAsync Composition" $ compose wAsyncly mempty sort
218− describe "Parallel Composition" $ compose parallely mempty sort
219− describe "Semigroup Composition for ZipSerial" $ compose zipSerially mempty id
220− describe "Semigroup Composition for ZipAsync" $ compose zipAsyncly mempty id
221− -- XXX need to check alternative compositions as well
222189
223190 ---------------------------------------------------------------------------
224191 -- TBD Monoidal composition combinations
@@ -903,39 +870,6 @@ parallelCheck t f = do
903870
904871 where event n = S.yieldM (threadDelay (n * 200000)) >> return n
905872
906−compose :: (IsStream t, Semigroup (t IO Int))
907− => (t IO Int -> SerialT IO Int) -> t IO Int -> ([Int] -> [Int]) -> Spec
908−compose t z srt = do
909− -- XXX these should get covered by the property tests
910− it "Compose mempty, mempty" $
911− tl (z <> z) `shouldReturn` ([] :: [Int])
912− it "Compose empty at the beginning" $
913− tl (z <> singleton 1) `shouldReturn` [1]
914− it "Compose empty at the end" $
915− tl (singleton 1 <> z) `shouldReturn` [1]
916− it "Compose two" $
917− srt <$> tl (singleton 0 <> singleton 1)
918− `shouldReturn` [0, 1]
919− it "Compose many" $
920− srt <$> tl (S.forEachWith (<>) [1..100] singleton)
921− `shouldReturn` [1..100]
922−
923− -- These are not covered by the property tests
924− it "Compose three - empty in the middle" $
925− srt <$> tl (singleton 0 <> z <> singleton 1)
926− `shouldReturn` [0, 1]
927− it "Compose left associated" $
928− srt <$> tl (((singleton 0 <> singleton 1) <> singleton 2) <> singleton 3)
929− `shouldReturn` [0, 1, 2, 3]
930− it "Compose right associated" $
931− srt <$> tl (singleton 0 <> (singleton 1 <> (singleton 2 <> singleton 3)))
932− `shouldReturn` [0, 1, 2, 3]
933− it "Compose hierarchical (multiple levels)" $
934− srt <$> tl (((singleton 0 <> singleton 1) <> (singleton 2 <> singleton 3))
935− <> ((singleton 4 <> singleton 5) <> (singleton 6 <> singleton 7)))
936− `shouldReturn` [0..7]
937− where tl = S.toList . t
938−
939873composeAndComposeSimple
940874 :: ( IsStream t1, Semigroup (t1 IO Int)
941875 , IsStream t2, Monoid (t2 IO Int), Monad (t2 IO)