aboutsummaryrefslogtreecommitdiff
path: root/vendor/flume/tests/same_channel.rs
blob: c6452ecb797f2b6175358027b3cd3aaa8d1089c1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// extern crate crossbeam_channel;

// use std::time::Duration;

// use crossbeam_channel::{after, bounded, never, tick, unbounded};

// fn ms(ms: u64) -> Duration {
//     Duration::from_millis(ms)
// }

// #[test]
// fn after_same_channel() {
//     let r = after(ms(50));

//     let r2 = r.clone();
//     assert!(r.same_channel(&r2));

//     let r3 = after(ms(50));
//     assert!(!r.same_channel(&r3));
//     assert!(!r2.same_channel(&r3));

//     let r4 = after(ms(100));
//     assert!(!r.same_channel(&r4));
//     assert!(!r2.same_channel(&r4));
// }

// #[test]
// fn array_same_channel() {
//     let (s, r) = bounded::<usize>(1);

//     let s2 = s.clone();
//     assert!(s.same_channel(&s2));

//     let r2 = r.clone();
//     assert!(r.same_channel(&r2));

//     let (s3, r3) = bounded::<usize>(1);
//     assert!(!s.same_channel(&s3));
//     assert!(!s2.same_channel(&s3));
//     assert!(!r.same_channel(&r3));
//     assert!(!r2.same_channel(&r3));
// }

// #[test]
// fn list_same_channel() {
//     let (s, r) = unbounded::<usize>();

//     let s2 = s.clone();
//     assert!(s.same_channel(&s2));

//     let r2 = r.clone();
//     assert!(r.same_channel(&r2));

//     let (s3, r3) = unbounded::<usize>();
//     assert!(!s.same_channel(&s3));
//     assert!(!s2.same_channel(&s3));
//     assert!(!r.same_channel(&r3));
//     assert!(!r2.same_channel(&r3));
// }

// #[test]
// fn never_same_channel() {
//     let r = never::<usize>();

//     let r2 = r.clone();
//     assert!(r.same_channel(&r2));

//     // Never channel are always equal to one another.
//     let r3 = never::<usize>();
//     assert!(r.same_channel(&r3));
//     assert!(r2.same_channel(&r3));
// }

// #[test]
// fn tick_same_channel() {
//     let r = tick(ms(50));

//     let r2 = r.clone();
//     assert!(r.same_channel(&r2));

//     let r3 = tick(ms(50));
//     assert!(!r.same_channel(&r3));
//     assert!(!r2.same_channel(&r3));

//     let r4 = tick(ms(100));
//     assert!(!r.same_channel(&r4));
//     assert!(!r2.same_channel(&r4));
// }

// #[test]
// fn zero_same_channel() {
//     let (s, r) = bounded::<usize>(0);

//     let s2 = s.clone();
//     assert!(s.same_channel(&s2));

//     let r2 = r.clone();
//     assert!(r.same_channel(&r2));

//     let (s3, r3) = bounded::<usize>(0);
//     assert!(!s.same_channel(&s3));
//     assert!(!s2.same_channel(&s3));
//     assert!(!r.same_channel(&r3));
//     assert!(!r2.same_channel(&r3));
// }

// #[test]
// fn different_flavors_same_channel() {
//     let (s1, r1) = bounded::<usize>(0);
//     let (s2, r2) = unbounded::<usize>();

//     assert!(!s1.same_channel(&s2));
//     assert!(!r1.same_channel(&r2));
// }