1 | use futures::executor::block_on; |
2 | use futures::future::{ready, select_all}; |
3 | use std::collections::HashSet; |
4 | |
5 | #[test] |
6 | fn smoke() { |
7 | let v = vec![ready(1), ready(2), ready(3)]; |
8 | |
9 | let mut c = vec![1, 2, 3].into_iter().collect::<HashSet<_>>(); |
10 | |
11 | let (i, idx, v) = block_on(select_all(v)); |
12 | assert!(c.remove(&i)); |
13 | assert_eq!(idx, 0); |
14 | |
15 | let (i, idx, v) = block_on(select_all(v)); |
16 | assert!(c.remove(&i)); |
17 | assert_eq!(idx, 0); |
18 | |
19 | let (i, idx, v) = block_on(select_all(v)); |
20 | assert!(c.remove(&i)); |
21 | assert_eq!(idx, 0); |
22 | |
23 | assert!(c.is_empty()); |
24 | assert!(v.is_empty()); |
25 | } |
26 | |