-
Notifications
You must be signed in to change notification settings - Fork 1
test: add async tests #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Great work 👍 |
tests/async.rs
Outdated
| if i % 2 == 0 { | ||
| flag.store(true, Ordering::SeqCst); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider moving this after barrier.wait().await and before ps.wake(), or f.await just immediately returns in these tasks.
tests/async.rs
Outdated
| task::yield_now().await; | ||
| assert_eq!(counter.count(), 33); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the counter and carefully check the corresponding task is finished?
tests/async.rs
Outdated
| let results = future::join_all(ready).await; | ||
| assert_eq!(results.len(), 33); | ||
| assert!(results.into_iter().all(|r| r.is_ok())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Nitpick] This can be simplified by using try_join_all.
tests/async.rs
Outdated
| let results = future::join_all(pending).await; | ||
| assert_eq!(results.len(), 32); | ||
| assert!(results.into_iter().all(|r| r.is_ok())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Nitpick] Same here.
No description provided.