Skip to content

Commit

Permalink
Fixed Unit test's
Browse files Browse the repository at this point in the history
  • Loading branch information
Juha Heiskanen committed Oct 26, 2020
1 parent 1ff9b1d commit 0f6666a
Showing 1 changed file with 25 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -310,19 +310,36 @@ bool test_mpx_msg_send()
data_req.msdu = test_data;
data_req.msduHandle = 10;
data_req.msduLength = 80;


//Test Configure missing part
valid_mpx_conf = false;
test_status = MLME_TRANSACTION_OVERFLOW;
mpx_handle_test = 10;
nsdynmemlib_stub.returnCounter = 0;
mpx_api->mpx_data_request(mpx_api, &data_req, 0xA0ED);
if (!valid_mpx_conf) {
return false;
}


ws_hopping_schedule_t hopping_schedule;
memset(&hopping_schedule, 0, sizeof(ws_hopping_schedule_t));
ws_llc_hopping_schedule_config(&interface, &hopping_schedule);
//Test Heap failure
data_req.msduHandle = 11;
valid_mpx_conf = false;
test_status = MLME_SUCCESS;
test_status = MLME_TRANSACTION_OVERFLOW;
mpx_handle_test = 11;

mpx_api->mpx_data_request(mpx_api, &data_req, 0xA0ED);
if (!valid_mpx_conf) {
return false;
}

data_req.msduHandle = 12;
valid_mpx_conf = false;
test_status = MLME_SUCCESS;
mpx_handle_test = 12;
nsdynmemlib_stub.returnCounter = 1;
mpx_api->mpx_data_request(mpx_api, &data_req, 0xA0ED);
if (valid_mpx_conf) {
Expand All @@ -334,7 +351,6 @@ bool test_mpx_msg_send()
memset(&conf_payload, 0, sizeof(mcps_data_conf_payload_t));
data_conf.msduHandle = test_handle + 1;
data_conf.status = MLME_SUCCESS;

data_confirmation_cb(&api, &data_conf, &conf_payload);
if (valid_mpx_conf) {
return false;
Expand All @@ -347,24 +363,25 @@ bool test_mpx_msg_send()
}

//Test Purge
data_req.msduHandle = 12;
data_req.msduHandle = 13;
valid_mpx_conf = false;
test_status = MLME_SUCCESS;
mpx_handle_test = 12;
mpx_handle_test = 13;
nsdynmemlib_stub.returnCounter = 1;
mpx_api->mpx_data_request(mpx_api, &data_req, 0xA0ED);
uint8_t test_1 = test_handle;
data_req.msduHandle = 13;
data_req.msduHandle = 14;
nsdynmemlib_stub.returnCounter = 1;
mpx_api->mpx_data_request(mpx_api, &data_req, 0xA0ED);
uint8_t test_2 = test_handle;

struct mcps_purge_s purge;
purge.msduHandle = 12;
mpx_api->mpx_data_purge(mpx_api, &purge, 0xA0ED);
purge.msduHandle = 13;
mpx_api->mpx_data_purge(mpx_api, &purge, 0xA0ED);
purge.msduHandle = 14;
mpx_api->mpx_data_purge(mpx_api, &purge, 0xA0ED);
//Purge and after that test confirm
valid_mpx_conf = false;
data_conf.msduHandle = test_handle;
data_confirmation_cb(&api, &data_conf, &conf_payload);
if (valid_mpx_conf) {
Expand Down

0 comments on commit 0f6666a

Please sign in to comment.