Skip to content

Commit

Permalink
Update unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
al8n committed May 27, 2024
1 parent 168d547 commit 70d3255
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/option_duration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,23 +382,30 @@ mod tests {
Ordering::SeqCst,
Ordering::SeqCst,
);

if result.is_ok() {
break;
}
}

assert!(result.is_ok());
assert_eq!(atomic_duration.load(Ordering::SeqCst), None);

// Change back to Some(Duration)
let new_duration = Duration::from_secs(6);
let result = atomic_duration.compare_exchange_weak(
None,
Some(new_duration),
Ordering::SeqCst,
Ordering::SeqCst,
);
assert!(result.is_ok());
let mut result;

loop {
result = atomic_duration.compare_exchange_weak(
None,
Some(new_duration),
Ordering::SeqCst,
Ordering::SeqCst,
);
if result.is_ok() {
break;
}
}

assert_eq!(atomic_duration.load(Ordering::SeqCst), Some(new_duration));
}

Expand Down

0 comments on commit 70d3255

Please sign in to comment.