Skip to content

Commit

Permalink
basic tests for fold_chunks and fold_chunks_with iterators
Browse files Browse the repository at this point in the history
  • Loading branch information
willcrozi committed Sep 12, 2022
1 parent a77408a commit 5475859
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/compile_fail/must_use.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ must_use! {
step_by /** v.par_iter().step_by(2); */
chain /** v.par_iter().chain(&v); */
chunks /** v.par_iter().chunks(2); */
fold_chunks /** v.par_iter().fold_chunks(2, || 0, |x, _| x); */
fold_chunks_with /** v.par_iter().fold_chunks_with(2, 0, |x, _| x); */
cloned /** v.par_iter().cloned(); */
copied /** v.par_iter().copied(); */
enumerate /** v.par_iter().enumerate(); */
Expand Down
2 changes: 2 additions & 0 deletions tests/clones.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ fn clone_adaptors() {
check(v.par_iter().flatten_iter());
check(v.par_iter().with_max_len(1).fold(|| 0, |x, _| x));
check(v.par_iter().with_max_len(1).fold_with(0, |x, _| x));
check(v.par_iter().with_max_len(1).fold_chunks(1, || 0, |x, _| x));
check(v.par_iter().with_max_len(1).fold_chunks_with(1, 0, |x, _| x));
check(v.par_iter().with_max_len(1).try_fold(|| 0, |_, &x| x));
check(v.par_iter().with_max_len(1).try_fold_with(0, |_, &x| x));
check(v.par_iter().inspect(|_| ()));
Expand Down
2 changes: 2 additions & 0 deletions tests/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ fn debug_adaptors() {
check(v.par_iter().map(Some).flatten_iter());
check(v.par_iter().fold(|| 0, |x, _| x));
check(v.par_iter().fold_with(0, |x, _| x));
check(v.par_iter().fold_chunks(3, || 0, |x, _| x));
check(v.par_iter().fold_chunks_with(3, 0, |x, _| x));
check(v.par_iter().try_fold(|| 0, |x, _| Some(x)));
check(v.par_iter().try_fold_with(0, |x, _| Some(x)));
check(v.par_iter().inspect(|_| ()));
Expand Down

0 comments on commit 5475859

Please sign in to comment.