Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
apfitzge committed Dec 2, 2024
1 parent ba11c0a commit 23705c5
Showing 1 changed file with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -755,4 +755,39 @@ mod tests {
let any_threads = ThreadSet::any(MAX_THREADS);
assert_eq!(any_threads.num_threads(), MAX_THREADS as u32);
}

#[test]
fn test_thread_set_iter() {
let mut thread_set = ThreadSet::none();
assert!(thread_set.contained_threads_iter().next().is_none());

thread_set.insert(4);
assert_eq!(
thread_set.contained_threads_iter().collect::<Vec<_>>(),
vec![4]
);

thread_set.insert(5);
assert_eq!(
thread_set.contained_threads_iter().collect::<Vec<_>>(),
vec![4, 5]
);
thread_set.insert(63);
assert_eq!(
thread_set.contained_threads_iter().collect::<Vec<_>>(),
vec![4, 5, 63]
);

thread_set.remove(5);
assert_eq!(
thread_set.contained_threads_iter().collect::<Vec<_>>(),
vec![4, 63]
);

let thread_set = ThreadSet::any(64);
assert_eq!(
thread_set.contained_threads_iter().collect::<Vec<_>>(),
(0..64).collect::<Vec<_>>()
);
}
}

0 comments on commit 23705c5

Please sign in to comment.