Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add thorough tests for Producer::split_at #457

Merged
merged 2 commits into from Oct 14, 2017

Conversation

Projects
None yet
1 participant
@cuviper
Copy link
Member

cuviper commented Oct 14, 2017

This takes one of the test cases from intersperse, which was very
helpful in poking corner cases, and generalizes it to test all
Producers.

This found a semi-bug with enumerate().rev() in the process -- by
zipping with indexes up to usize::MAX, reverse iteration has to
iterate a loooong way back. It now uses the exact length needed.

cuviper added some commits Oct 14, 2017

Add thorough tests for Producer::split_at
This takes one of the test cases from `intersperse`, which was very
helpful in poking corner cases, and generalizes it to test all
`Producer`s.

This found a semi-bug with `enumerate().rev()` in the process -- by
zipping with indexes up to `usize::MAX`, reverse iteration has to
iterate a loooong way back.  It now uses the exact length needed.
Check Iterator lengths harder
The `SliceDrain` iterator (for `VecProducer`) had an exact `len()`, but
no `size_hint()`.  In the convoluted `check_chain` test, this now got
exposed when `enumerate()` queried its base `len()`, through a chain
that uses the default `len()` with `size_hint()` assertions.  Whew.

Fix `SliceDrain`, and add assertions that `len()` *and* `size_hint()`
have the expected value for all producers.
@cuviper

This comment has been minimized.

Copy link
Member Author

cuviper commented Oct 14, 2017

bors r+

bors bot added a commit that referenced this pull request Oct 14, 2017

Merge #457 #458
457: Add thorough tests for Producer::split_at r=cuviper a=cuviper

This takes one of the test cases from `intersperse`, which was very
helpful in poking corner cases, and generalizes it to test all
`Producer`s.

This found a semi-bug with `enumerate().rev()` in the process -- by
zipping with indexes up to `usize::MAX`, reverse iteration has to
iterate a loooong way back.  It now uses the exact length needed.

458: Inherent mutability -> Interior mutablility r=cuviper a=MajorBreakfast

The rust book calls this "interior mutability". I think that the two terms were just confused because they sound awfully similar.

First edition: https://doc.rust-lang.org/book/first-edition/mutability.html
Second edition: https://doc.rust-lang.org/book/second-edition/ch15-05-interior-mutability.html#refcellt-and-the-interior-mutability-pattern
@bors

This comment has been minimized.

Copy link
Contributor

bors bot commented Oct 14, 2017

@bors bors bot merged commit ccf7511 into rayon-rs:master Oct 14, 2017

2 checks passed

bors Build succeeded
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@cuviper cuviper deleted the cuviper:test-producer-split_at branch Oct 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.