Skip to content

Commit

Permalink
Only run find_first/last octillion on 64-bit targets
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Sep 15, 2020
1 parent 8a53a49 commit 5af9d7e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/octillion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,25 @@ fn octillion_flat() -> impl ParallelIterator<Item = u128> {
})
}

// NOTE: `find_first` and `find_last` currently take too long on 32-bit targets,
// because the `AtomicUsize` match position has much too limited resolution.

#[test]
#[cfg_attr(not(target_pointer_width = "64"), ignore)]
fn find_first_octillion() {
let x = octillion().find_first(|_| true);
assert_eq!(x, Some(0));
}

#[test]
#[cfg_attr(not(target_pointer_width = "64"), ignore)]
fn find_first_octillion_inclusive() {
let x = octillion_inclusive().find_first(|_| true);
assert_eq!(x, Some(0));
}

#[test]
#[cfg_attr(not(target_pointer_width = "64"), ignore)]
fn find_first_octillion_flat() {
let x = octillion_flat().find_first(|_| true);
assert_eq!(x, Some(0));
Expand All @@ -62,6 +68,7 @@ fn two_threads<F: Send + FnOnce() -> R, R: Send>(f: F) -> R {
}

#[test]
#[cfg_attr(not(target_pointer_width = "64"), ignore)]
fn find_last_octillion() {
// It would be nice if `find_last` could prioritize the later splits,
// basically flipping the `join` args, without needing indexed `rev`.
Expand All @@ -71,12 +78,14 @@ fn find_last_octillion() {
}

#[test]
#[cfg_attr(not(target_pointer_width = "64"), ignore)]
fn find_last_octillion_inclusive() {
let x = two_threads(|| octillion_inclusive().find_last(|_| true));
assert_eq!(x, Some(OCTILLION));
}

#[test]
#[cfg_attr(not(target_pointer_width = "64"), ignore)]
fn find_last_octillion_flat() {
let x = two_threads(|| octillion_flat().find_last(|_| true));
assert_eq!(x, Some(OCTILLION - 1));
Expand Down

0 comments on commit 5af9d7e

Please sign in to comment.