More specialization tests#799
Merged
Philippe-Cholet merged 6 commits intorust-itertools:masterfrom Nov 13, 2023
Merged
Conversation
jswrenn
approved these changes
Nov 13, 2023
Member
jswrenn
left a comment
There was a problem hiding this comment.
This looks good to me. You can go ahead and merge this as-is, or you can add a test for multi_cartesian_product and mark it as #[ignore] (so we don't forget about it, but it also doesn't fail CI).
`private::{DuplicatesBy, Meta}` both derive `Clone` but it's not enough for `DuplicatesBy` and `Duplicates` to derive it as well, because `ById` and `ByFn` do not yet.
I think users are do not want to clone it as it would clone a `HashMap` and it would probably be slow.
However, I need that to add specialization tests.
I do not want to add them one by one in future pull requests so this is done!
For tests to not be slow, we sometimes need small enough inputs but I should not have truncated inputs previously. Thanks to jswrenn, I now know that the right quickcheck-way is to discard some inputs (it then asks for other inputs).
234bb53 to
62e11b0
Compare
Merged
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.
test_specializationsneed clonable iterators which helped find iterators that should be clonable but were not yet. 3 very small commits.Now about mostly done... Not all of our iterators are tested here:
group_bychunksteercitertest_specializationsneed clonable iterators but&mut iteratoris not clonable, Therefore, we can't clonePeekingTakeWhileandTakeWhileRef. We need to find a way to test them too.Finally a bug...
multi_cartesian_productis not tested here because specializations oflastandcountFAIL sometimes, and I don't want this pull request to be blocked by it! It requires further investigation and will have a dedicated pull request.EDIT: Apparently, the iterator is not fused even when all child iterators are, and this was the intended behavior, that's confusing.
Later EDITs: While making a bunch of specialization benchmarks, I noticed that I forgot some and some here:
repeat_nTupleBuffer(buffer for a finished.tuples())MapForGroupingused forGroupingMapBybut it's strictly internal to the library, a method ofGroupingMapByshould be tested to test the specialization of futureMapForGrouping::fold.unfold,iterate: infinite iterators so e.g. testlastwould not finish.