| 237 | |
| 238 | #[tokio::test] |
| 239 | async fn phc_stream() { |
| 240 | let (_link_local_tx, link_local_rx) = create(1); |
| 241 | let (phc_tx, phc_rx) = create(1); |
| 242 | |
| 243 | let mut rx_stream = ReceiverStream::builder() |
| 244 | .link_local(link_local_rx) |
| 245 | .phc(phc_rx) |
| 246 | .build(); |
| 247 | |
| 248 | let phc_data = event::Phc::builder() |
| 249 | .tsc_pre(TscCount::new(1)) |
| 250 | .tsc_post(TscCount::new(2)) |
| 251 | .data(PhcData { |
| 252 | clock_error_bound: Duration::from_micros(20), |
| 253 | time: Instant::from_days(3), |
| 254 | }) |
| 255 | .build() |
| 256 | .unwrap(); |
| 257 | |
| 258 | phc_tx.send(phc_data.clone()).unwrap(); |
| 259 | |
| 260 | let result = rx_stream.recv().await.unwrap(); |
| 261 | let RoutableEvent::Phc(data) = &result else { |
| 262 | panic!("Expected to receive a Phc event, got {result:?}") |
| 263 | }; |
| 264 | |
| 265 | assert_eq!(*data, phc_data); |
| 266 | } |
| 267 | |
| 268 | #[test] |
| 269 | fn add_ntp_source() { |