MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / test_handle

Function test_handle

chirpstack/src/maccommand/ping_slot_channel.rs:95–207  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

93
94 #[test]
95 fn test_handle() {
96 let tests = vec![
97 Test {
98 name: "pending request and positive ACK updates frequency and data-rate".into(),
99 device_session: internal::DeviceSession {
100 class_b_ping_slot_freq: 868100000,
101 class_b_ping_slot_dr: 3,
102 mac_command_error_count: [(lrwn::CID::PingSlotChannelReq.to_u8() as u32, 1)]
103 .iter()
104 .cloned()
105 .collect(),
106 ..Default::default()
107 },
108 ping_slot_channel_req: Some(lrwn::MACCommandSet::new(vec![
109 lrwn::MACCommand::PingSlotChannelReq(lrwn::PingSlotChannelReqPayload {
110 freq: 868300000,
111 dr: 4,
112 }),
113 ])),
114 ping_slot_channel_ans: lrwn::MACCommandSet::new(vec![
115 lrwn::MACCommand::PingSlotChannelAns(lrwn::PingSlotChannelAnsPayload {
116 dr_ok: true,
117 channel_freq_ok: true,
118 }),
119 ]),
120 expected_device_session: internal::DeviceSession {
121 class_b_ping_slot_freq: 868300000,
122 class_b_ping_slot_dr: 4,
123 ..Default::default()
124 },
125 expected_error: None,
126 },
127 Test {
128 name: "pending request and negative ACK does not update".into(),
129 device_session: internal::DeviceSession {
130 class_b_ping_slot_freq: 868100000,
131 class_b_ping_slot_dr: 3,
132 mac_command_error_count: [(lrwn::CID::PingSlotChannelReq.to_u8() as u32, 1)]
133 .iter()
134 .cloned()
135 .collect(),
136 ..Default::default()
137 },
138 ping_slot_channel_req: Some(lrwn::MACCommandSet::new(vec![
139 lrwn::MACCommand::PingSlotChannelReq(lrwn::PingSlotChannelReqPayload {
140 freq: 868300000,
141 dr: 4,
142 }),
143 ])),
144 ping_slot_channel_ans: lrwn::MACCommandSet::new(vec![
145 lrwn::MACCommand::PingSlotChannelAns(lrwn::PingSlotChannelAnsPayload {
146 dr_ok: false,
147 channel_freq_ok: true,
148 }),
149 ]),
150 expected_device_session: internal::DeviceSession {
151 class_b_ping_slot_freq: 868100000,
152 class_b_ping_slot_dr: 3,

Callers

nothing calls this directly

Calls 3

as_refMethod · 0.80
handleFunction · 0.70
intoMethod · 0.45

Tested by

no test coverage detected