-
Notifications
You must be signed in to change notification settings - Fork 233
[ISSUE #6211][Test🧪] Add unit tests for PopProcessQueueInfo #6317
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
Changes from 4 commits
6bb14e4
6bdf75a
0b8e4c4
39b7009
720dff6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -62,3 +62,134 @@ impl std::fmt::Display for PopProcessQueueInfo { | |||||||||||||||||||
| ) | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| #[cfg(test)] | ||||||||||||||||||||
| mod tests { | ||||||||||||||||||||
| use super::*; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| #[test] | ||||||||||||||||||||
| fn pop_process_queue_init() { | ||||||||||||||||||||
| let queue: PopProcessQueueInfo = PopProcessQueueInfo::new(10, false, 123456789); | ||||||||||||||||||||
| assert_eq!(queue.wait_ack_count(), 10); | ||||||||||||||||||||
| assert!(!queue.droped()); | ||||||||||||||||||||
| assert_eq!(queue.last_pop_timestamp(), 123456789); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| #[test] | ||||||||||||||||||||
| fn pop_process_queue_setters() { | ||||||||||||||||||||
| let mut queue: PopProcessQueueInfo = PopProcessQueueInfo::new(10, false, 123456789); | ||||||||||||||||||||
| queue.set_wait_ack_count(20); | ||||||||||||||||||||
| queue.set_droped(true); | ||||||||||||||||||||
| queue.set_last_pop_timestamp(987654321); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| assert_eq!(queue.wait_ack_count(), 20); | ||||||||||||||||||||
| assert!(queue.droped()); | ||||||||||||||||||||
| assert_eq!(queue.last_pop_timestamp(), 987654321); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| #[test] | ||||||||||||||||||||
| fn pop_process_queue_clone() { | ||||||||||||||||||||
| let queue: PopProcessQueueInfo = PopProcessQueueInfo::new(10, false, 123456789); | ||||||||||||||||||||
| let cloned = queue; | ||||||||||||||||||||
| assert_eq!(cloned.wait_ack_count(), 10); | ||||||||||||||||||||
| assert!(!cloned.droped()); | ||||||||||||||||||||
| assert_eq!(cloned.last_pop_timestamp(), 123456789); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| #[test] | ||||||||||||||||||||
| fn pop_process_queue_display() { | ||||||||||||||||||||
| let queue: PopProcessQueueInfo = PopProcessQueueInfo::new(10, false, 123456789); | ||||||||||||||||||||
| let display = format!("{}", queue); | ||||||||||||||||||||
| assert_eq!( | ||||||||||||||||||||
| display, | ||||||||||||||||||||
| "PopProcessQueueInfo [wait_ack_count: 10, droped: false, last_pop_timestamp: 123456789]" | ||||||||||||||||||||
| ); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| #[test] | ||||||||||||||||||||
| fn pop_process_queue_copy() { | ||||||||||||||||||||
| let queue: PopProcessQueueInfo = PopProcessQueueInfo::new(10, false, 123456789); | ||||||||||||||||||||
| let copied = queue; | ||||||||||||||||||||
| assert_eq!(copied.wait_ack_count(), 10); | ||||||||||||||||||||
| assert!(!copied.droped()); | ||||||||||||||||||||
| assert_eq!(copied.last_pop_timestamp(), 123456789); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
Comment on lines
+108
to
+116
|
||||||||||||||||||||
| #[test] | |
| fn pop_process_queue_copy() { | |
| let queue: PopProcessQueueInfo = PopProcessQueueInfo::new(10, false, 123456789); | |
| let copied = queue; | |
| assert_eq!(copied.wait_ack_count(), 10); | |
| assert!(!copied.droped()); | |
| assert_eq!(copied.last_pop_timestamp(), 123456789); | |
| } |
Uh oh!
There was an error while loading. Please reload this page.