()
| 4399 | |
| 4400 | #[tokio::test] |
| 4401 | async fn test_request_ctrl_uplink_list() { |
| 4402 | struct Test { |
| 4403 | name: String, |
| 4404 | relay_devices: Vec<EUI64>, |
| 4405 | device_session: internal::DeviceSession, |
| 4406 | expected_mac_commands: Vec<lrwn::MACCommandSet>, |
| 4407 | } |
| 4408 | |
| 4409 | let tests = vec![ |
| 4410 | Test { |
| 4411 | name: "w_f_cnt has been recently requested".into(), |
| 4412 | relay_devices: vec![EUI64::from_be_bytes([1, 1, 1, 1, 1, 1, 1, 2])], |
| 4413 | device_session: internal::DeviceSession { |
| 4414 | relay: Some(internal::Relay { |
| 4415 | devices: vec![internal::RelayDevice { |
| 4416 | index: 1, |
| 4417 | w_f_cnt_last_request: Some(Utc::now().into()), |
| 4418 | dev_eui: vec![1, 1, 1, 1, 1, 1, 1, 2], |
| 4419 | ..Default::default() |
| 4420 | }], |
| 4421 | ..Default::default() |
| 4422 | }), |
| 4423 | ..Default::default() |
| 4424 | }, |
| 4425 | expected_mac_commands: vec![], |
| 4426 | }, |
| 4427 | Test { |
| 4428 | name: "w_f_cnt has never been requested".into(), |
| 4429 | relay_devices: vec![EUI64::from_be_bytes([1, 1, 1, 1, 1, 1, 1, 2])], |
| 4430 | device_session: internal::DeviceSession { |
| 4431 | relay: Some(internal::Relay { |
| 4432 | devices: vec![internal::RelayDevice { |
| 4433 | index: 1, |
| 4434 | w_f_cnt_last_request: None, |
| 4435 | dev_eui: vec![1, 1, 1, 1, 1, 1, 1, 2], |
| 4436 | ..Default::default() |
| 4437 | }], |
| 4438 | ..Default::default() |
| 4439 | }), |
| 4440 | ..Default::default() |
| 4441 | }, |
| 4442 | expected_mac_commands: vec![lrwn::MACCommandSet::new(vec![ |
| 4443 | lrwn::MACCommand::CtrlUplinkListReq(lrwn::CtrlUplinkListReqPayload { |
| 4444 | ctrl_uplink_action: lrwn::CtrlUplinkActionPL { |
| 4445 | uplink_list_idx: 1, |
| 4446 | ctrl_uplink_action: 0, |
| 4447 | }, |
| 4448 | }), |
| 4449 | ])], |
| 4450 | }, |
| 4451 | Test { |
| 4452 | name: "w_f_cnt has been requested two days ago".into(), |
| 4453 | relay_devices: vec![EUI64::from_be_bytes([1, 1, 1, 1, 1, 1, 1, 2])], |
| 4454 | device_session: internal::DeviceSession { |
| 4455 | relay: Some(internal::Relay { |
| 4456 | devices: vec![internal::RelayDevice { |
| 4457 | index: 1, |
| 4458 | w_f_cnt_last_request: Some( |
nothing calls this directly
no test coverage detected