aboutsummaryrefslogtreecommitdiff
path: root/tests/clones.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/clones.rs')
-rw-r--r--tests/clones.rs20
1 files changed, 18 insertions, 2 deletions
diff --git a/tests/clones.rs b/tests/clones.rs
index 2b78f09..0d6c864 100644
--- a/tests/clones.rs
+++ b/tests/clones.rs
@@ -10,6 +10,13 @@ where
assert_eq!(a, b);
}
+fn check_count<I>(iter: I)
+where
+ I: ParallelIterator + Clone,
+{
+ assert_eq!(iter.clone().count(), iter.count());
+}
+
#[test]
fn clone_binary_heap() {
use std::collections::BinaryHeap;
@@ -150,8 +157,10 @@ fn clone_adaptors() {
check(v.par_iter().panic_fuse());
check(v.par_iter().positions(|_| true));
check(v.par_iter().rev());
- check(v.par_iter().skip(1));
- check(v.par_iter().take(1));
+ check(v.par_iter().skip(42));
+ check(v.par_iter().skip_any_while(|_| false));
+ check(v.par_iter().take(42));
+ check(v.par_iter().take_any_while(|_| true));
check(v.par_iter().cloned().while_some());
check(v.par_iter().with_max_len(1));
check(v.par_iter().with_min_len(1));
@@ -161,6 +170,13 @@ fn clone_adaptors() {
}
#[test]
+fn clone_counted_adaptors() {
+ let v: Vec<_> = (0..1000).collect();
+ check_count(v.par_iter().skip_any(42));
+ check_count(v.par_iter().take_any(42));
+}
+
+#[test]
fn clone_empty() {
check(rayon::iter::empty::<i32>());
}