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

Function test_handle

chirpstack/src/maccommand/rx_param_setup.rs:103–210  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

101
102 #[test]
103 fn test_handle() {
104 let tests = vec![
105 Test {
106 name: "rx param setup ack".into(),
107 device_session: internal::DeviceSession {
108 rx2_frequency: 868100000,
109 rx2_dr: 0,
110 rx1_dr_offset: 1,
111 mac_command_error_count: [(lrwn::CID::RxParamSetupReq.to_u8() as u32, 1)]
112 .iter()
113 .cloned()
114 .collect(),
115 ..Default::default()
116 },
117 rx_param_setup_req: Some(lrwn::MACCommandSet::new(vec![
118 lrwn::MACCommand::RxParamSetupReq(lrwn::RxParamSetupReqPayload {
119 frequency: 868700000,
120 dl_settings: lrwn::DLSettings {
121 rx2_dr: 5,
122 rx1_dr_offset: 2,
123 opt_neg: false,
124 },
125 }),
126 ])),
127 rx_param_setup_ans: lrwn::MACCommandSet::new(vec![
128 lrwn::MACCommand::RxParamSetupAns(lrwn::RxParamSetupAnsPayload {
129 channel_ack: true,
130 rx2_dr_ack: true,
131 rx1_dr_offset_ack: true,
132 }),
133 ]),
134 expected_device_session: internal::DeviceSession {
135 rx2_frequency: 868700000,
136 rx2_dr: 5,
137 rx1_dr_offset: 2,
138 ..Default::default()
139 },
140 expected_error: None,
141 },
142 Test {
143 name: "rx param setup nack".into(),
144 device_session: internal::DeviceSession {
145 rx2_frequency: 868100000,
146 rx2_dr: 0,
147 rx1_dr_offset: 1,
148 mac_command_error_count: [(lrwn::CID::RxParamSetupReq.to_u8() as u32, 1)]
149 .iter()
150 .cloned()
151 .collect(),
152 ..Default::default()
153 },
154 rx_param_setup_req: Some(lrwn::MACCommandSet::new(vec![
155 lrwn::MACCommand::RxParamSetupReq(lrwn::RxParamSetupReqPayload {
156 frequency: 868700000,
157 dl_settings: lrwn::DLSettings {
158 rx2_dr: 5,
159 rx1_dr_offset: 2,
160 opt_neg: false,

Callers

nothing calls this directly

Calls 3

as_refMethod · 0.80
handleFunction · 0.70
intoMethod · 0.45

Tested by

no test coverage detected