mirror of
https://github.com/composewell/streamly.git
synced 2024-09-11 19:47:10 +03:00
Add construction tests for serial streams.
This commit is contained in:
parent
a6341ee5ec
commit
7263bf5c90
@ -338,8 +338,10 @@ constructWithEnumerateTo ::
|
||||
constructWithEnumerateTo listT op len =
|
||||
withMaxSuccess maxTestCount $
|
||||
monadicIO $ do
|
||||
strm <- run $ S.toList . op $ S.enumerateTo (fromIntegral len)
|
||||
let list = enumFromTo minBound (fromIntegral len)
|
||||
-- It takes forever to enumerate from minBound to len, so
|
||||
-- instead we just do till len elements
|
||||
strm <- run $ S.toList . op $ S.enumerateTo (minBound + fromIntegral len)
|
||||
let list = enumFromTo minBound (minBound + fromIntegral len)
|
||||
listEquals (==) (listT strm) list
|
||||
|
||||
constructWithFromList ::
|
||||
|
@ -478,6 +478,9 @@ main = hspec
|
||||
-- (toListSerial mzero) `shouldReturn` ([] :: [Int])
|
||||
|
||||
describe "Construction" $ do
|
||||
-- Add all the construction tests for all stream types.
|
||||
serialOps $ prop "serially repeat" . constructWithRepeat
|
||||
serialOps $ prop "serially repeatM" . constructWithRepeatM
|
||||
serialOps $ prop "serially replicate" . constructWithReplicate
|
||||
serialOps $ prop "serially replicateM" . constructWithReplicateM
|
||||
serialOps $ prop "serially intFromThenTo" .
|
||||
@ -489,8 +492,15 @@ main = hspec
|
||||
serialOps $ prop "serially iterate" . constructWithIterate
|
||||
-- XXX test for all types of streams
|
||||
serialOps $ prop "serially iterateM" . constructWithIterateM
|
||||
serialOps $ prop "serially enumerate" . constructWithEnumerate id
|
||||
serialOps $ prop "serially enumerateTo" . constructWithEnumerateTo id
|
||||
serialOps $ prop "serially fromIndices" . constructWithFromIndices
|
||||
serialOps $ prop "serially fromIndicesM" . constructWithFromIndicesM
|
||||
serialOps $ prop "serially fromList" . constructWithFromList id
|
||||
serialOps $ prop "serially fromListM" . constructWithFromListM id
|
||||
serialOps $ prop "serially unfoldr" . constructWithUnfoldr id
|
||||
serialOps $ prop "serially yield" . constructWithYield id
|
||||
serialOps $ prop "serially yieldM" . constructWithYieldM id
|
||||
serialOps $ prop "serially cons" . constructWithCons S.cons
|
||||
serialOps $ prop "serially consM" . constructWithConsM S.consM id
|
||||
serialOps $ prop "serially (.:)" . constructWithCons (S..:)
|
||||
@ -500,6 +510,8 @@ main = hspec
|
||||
prop "unfold" unfold
|
||||
prop "unfold0" unfold0
|
||||
|
||||
describe "Simple Operations" $ serialOps simpleOps
|
||||
|
||||
describe "Functor operations" $ do
|
||||
serialOps $ functorOps S.fromFoldable "serially" (==)
|
||||
serialOps $ functorOps folded "serially folded" (==)
|
||||
|
@ -70,6 +70,9 @@ main = hspec
|
||||
#endif
|
||||
|
||||
describe "Construction" $ do
|
||||
wSerialOps $ prop "wSerially repeat" . constructWithRepeat
|
||||
wSerialOps $ prop "wSerially repeatM" . constructWithRepeatM
|
||||
wSerialOps $ prop "wSerially replicateM" . constructWithReplicate
|
||||
wSerialOps $ prop "wSerially replicateM" . constructWithReplicateM
|
||||
wSerialOps $ prop "wSerially cons" . constructWithCons S.cons
|
||||
wSerialOps $ prop "wSerially consM" . constructWithConsM S.consM id
|
||||
|
Loading…
Reference in New Issue
Block a user