Add tests for operations in Streamly.Prelude.#783
Merged
pranaysashank merged 19 commits intomasterfrom Dec 6, 2020
Merged
Conversation
2fee505 to
39559f6
Compare
harendra-kumar
requested changes
Dec 1, 2020
Member
harendra-kumar
left a comment
There was a problem hiding this comment.
update hie.yaml for all the test components.
fix hlint issues in the new code, if any.
| unfoldStep seed = | ||
| if seed > fromIntegral len | ||
| then Nothing | ||
| else Just (seed, seed + 1) |
| strm <- | ||
| run $ | ||
| S.toList . op . S.take (fromIntegral len) $ | ||
| foldr cons S.nil (repeat 0) |
Member
There was a problem hiding this comment.
run
$ S.toList . op . S.take (fromIntegral len)
$ foldr cons S.nil (repeat 0)
| strm <- | ||
| run $ | ||
| S.toList . op . S.take (fromIntegral len) $ | ||
| foldMap S.yield (repeat 0) |
| prop (desc <> " postscanlM'") $ transform (tail . scanl' (const id) 0) t | ||
| (S.postscanlM' (\_ a -> return a) (return 0)) | ||
| prop (desc <> " scanl") $ transform (scanl' (const id) 0) t | ||
| (S.scanl' (const id) 0) |
Member
There was a problem hiding this comment.
Duplicated test, same as the scanl' test.
| strm <- | ||
| run $ | ||
| S.toList . t $ S.before (writeIORef ioRef True) (S.fromList vec) | ||
| refValue <- run $ readIORef ioRef |
Member
There was a problem hiding this comment.
We are not making sure that it is actually happening before.
| strm <- | ||
| run $ | ||
| S.toList . t $ S.after (writeIORef ioRef True) (S.fromList vec) | ||
| refValue <- run $ readIORef ioRef |
| refValue <- run $ readIORef ioRef | ||
| assert $ refValue == 1 | ||
|
|
||
| -- XXX This test fails |
Member
There was a problem hiding this comment.
I will push a fix for this.
| describe "Construction" $ do | ||
| parallelOps $ prop "parallely replicateM" . constructWithReplicateM | ||
| parallelOps $ prop "parallely cons" . constructWithCons S.cons | ||
| -- parallelOps $ prop "parallely consM" . constructWithConsM S.consM sort |
| @@ -468,13 +492,26 @@ main = hspec | |||
| serialOps $ prop "serially iterate" . constructWithIterate | |||
| -- XXX test for all types of streams | |||
Member
There was a problem hiding this comment.
We can remove this comment now.
| -- (toListSerial mzero) `shouldReturn` ([] :: [Int]) | ||
|
|
||
| describe "Construction" $ do | ||
| -- Add all the construction tests for all stream types. |
Member
There was a problem hiding this comment.
We can remove this comment.
harendra-kumar
approved these changes
Dec 6, 2020
| foldr cons S.nil (repeat 0) | ||
| strm <- run | ||
| $ S.toList . op . S.take (fromIntegral len) | ||
| $ foldr cons S.nil (repeat 0) |
Member
There was a problem hiding this comment.
In such cases we put run on the next line:
strm <-
run
$ S.toList . op . S.take (fromIntegral len)
$ foldr cons S.nil (repeat 0)
4d71d25 to
d7b1cbd
Compare
- Add constructWithYield, yieldM, repeat, repeatM, enumerate, enumerateTo, fromList, fromListM, zipAsyncApplicative.
Added a small delay to let the cleanup run.
d7b1cbd to
425adca
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added basic tests for