summaryrefslogtreecommitdiff
path: root/vendor/flume/tests/never.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2024-01-08 00:21:28 +0300
committerValentin Popov <valentin@popov.link>2024-01-08 00:21:28 +0300
commit1b6a04ca5504955c571d1c97504fb45ea0befee4 (patch)
tree7579f518b23313e8a9748a88ab6173d5e030b227 /vendor/flume/tests/never.rs
parent5ecd8cf2cba827454317368b68571df0d13d7842 (diff)
downloadfparkan-1b6a04ca5504955c571d1c97504fb45ea0befee4.tar.xz
fparkan-1b6a04ca5504955c571d1c97504fb45ea0befee4.zip
Initial vendor packages
Signed-off-by: Valentin Popov <valentin@popov.link>
Diffstat (limited to 'vendor/flume/tests/never.rs')
-rw-r--r--vendor/flume/tests/never.rs99
1 files changed, 99 insertions, 0 deletions
diff --git a/vendor/flume/tests/never.rs b/vendor/flume/tests/never.rs
new file mode 100644
index 0000000..676903f
--- /dev/null
+++ b/vendor/flume/tests/never.rs
@@ -0,0 +1,99 @@
+// //! Tests for the never channel flavor.
+
+// #[macro_use]
+// extern crate crossbeam_channel;
+// extern crate rand;
+
+// use std::thread;
+// use std::time::{Duration, Instant};
+
+// use crossbeam_channel::{never, tick, unbounded};
+
+// fn ms(ms: u64) -> Duration {
+// Duration::from_millis(ms)
+// }
+
+// #[test]
+// fn smoke() {
+// select! {
+// recv(never::<i32>()) -> _ => panic!(),
+// default => {}
+// }
+// }
+
+// #[test]
+// fn optional() {
+// let (s, r) = unbounded::<i32>();
+// s.send(1).unwrap();
+// s.send(2).unwrap();
+
+// let mut r = Some(&r);
+// select! {
+// recv(r.unwrap_or(&never())) -> _ => {}
+// default => panic!(),
+// }
+
+// r = None;
+// select! {
+// recv(r.unwrap_or(&never())) -> _ => panic!(),
+// default => {}
+// }
+// }
+
+// #[test]
+// fn tick_n() {
+// let mut r = tick(ms(100));
+// let mut step = 0;
+
+// loop {
+// select! {
+// recv(r) -> _ => step += 1,
+// default(ms(500)) => break,
+// }
+
+// if step == 10 {
+// r = never();
+// }
+// }
+
+// assert_eq!(step, 10);
+// }
+
+// #[test]
+// fn capacity() {
+// let r = never::<i32>();
+// assert_eq!(r.capacity(), Some(0));
+// }
+
+// #[test]
+// fn len_empty_full() {
+// let r = never::<i32>();
+// assert_eq!(r.len(), 0);
+// assert_eq!(r.is_empty(), true);
+// assert_eq!(r.is_full(), true);
+// }
+
+// #[test]
+// fn try_recv() {
+// let r = never::<i32>();
+// assert!(r.try_recv().is_err());
+
+// thread::sleep(ms(100));
+// assert!(r.try_recv().is_err());
+// }
+
+// #[test]
+// fn recv_timeout() {
+// let start = Instant::now();
+// let r = never::<i32>();
+
+// assert!(r.recv_timeout(ms(100)).is_err());
+// let now = Instant::now();
+// assert!(now - start >= ms(100));
+// assert!(now - start <= ms(150));
+
+// assert!(r.recv_timeout(ms(100)).is_err());
+// let now = Instant::now();
+// assert!(now - start >= ms(200));
+// assert!(now - start <= ms(250));
+// }