Updating unit tests

Updating unit test in response to the change in the link ADR related
APIs.
pull/9601/head
Hasnain Virk 2019-02-04 16:57:53 +02:00
parent 726eff9305
commit a14acfad14
5 changed files with 23 additions and 1 deletions

View File

@ -181,6 +181,10 @@ TEST_F(Test_LoRaPHYAU915, link_ADR_request)
uint8_t nb_rep_out = 0;
uint8_t nb_bytes_parsed = 0;
uint8_t payload [] = {SRV_MAC_LINK_ADR_REQ, 1, 2, 3, 4};
params.payload = payload;
params.payload_size = 5;
LoRaPHY_stub::uint8_value = 1;
LoRaPHY_stub::ch_mask_value = 6;
LoRaPHY_stub::adr_parse_count = 2;

View File

@ -206,6 +206,10 @@ TEST_F(Test_LoRaPHYCN470, link_ADR_request)
uint8_t nb_rep_out = 0;
uint8_t nb_bytes_parsed = 0;
uint8_t payload [] = {SRV_MAC_LINK_ADR_REQ, 1, 2, 3, 4};
params.payload = payload;
params.payload_size = 5;
LoRaPHY_stub::uint8_value = 1;
LoRaPHY_stub::ch_mask_value = 6;
LoRaPHY_stub::adr_parse_count = 2;

View File

@ -177,6 +177,7 @@ TEST_F(Test_LoRaPHYUS915, tx_config)
TEST_F(Test_LoRaPHYUS915, link_ADR_request)
{
uint8_t payload [] = {SRV_MAC_LINK_ADR_REQ, 1, 2, 3, 4};
adr_req_params_t params;
memset(&params, 0, sizeof(params));
int8_t dr_out = 0;
@ -184,8 +185,14 @@ TEST_F(Test_LoRaPHYUS915, link_ADR_request)
uint8_t nb_rep_out = 0;
uint8_t nb_bytes_parsed = 0;
EXPECT_TRUE(0 == object->link_ADR_request(&params, &dr_out, &tx_power_out, &nb_rep_out, &nb_bytes_parsed));
params.payload = payload;
params.payload_size = 4;
uint8_t status = object->link_ADR_request(&params, &dr_out, &tx_power_out, &nb_rep_out, &nb_bytes_parsed);
EXPECT_TRUE(0 == nb_bytes_parsed);
params.payload_size = 5;
LoRaPHY_stub::uint8_value = 1;
LoRaPHY_stub::ch_mask_value = 6;
LoRaPHY_stub::adr_parse_count = 2;

View File

@ -494,6 +494,10 @@ TEST_F(Test_LoRaWANStack, handle_rx)
ind.buffer = ind_buf;
ind.buffer_size = 150;
ind.type = MCPS_UNCONFIRMED;
ind.port = 15;
ind.is_data_recvd = true;
ind.fpending_status = false;
LoRaMac_stub::dev_class_value = CLASS_A;
radio._ev->rx_done(NULL, 0, 0, 0);
//data == NULL || LENGTH == 0 (2 cases)

View File

@ -151,9 +151,12 @@ lorawan_time_t LoRaPHY::update_band_timeoff(bool joined, bool duty_cycle,
}
uint8_t LoRaPHY::parse_link_ADR_req(const uint8_t *payload,
uint8_t payload_size,
link_adr_params_t *params)
{
params->ch_mask_ctrl = LoRaPHY_stub::ch_mask_value;
params->channel_mask = 0;
params->datarate = 0;
if (LoRaPHY_stub::adr_parse_count) {
return --LoRaPHY_stub::adr_parse_count;