From 0f6666a97eb4b67d6df4d1dd18966d6af26ac0d0 Mon Sep 17 00:00:00 2001 From: Juha Heiskanen Date: Mon, 26 Oct 2020 12:52:35 +0200 Subject: [PATCH] Fixed Unit test's --- .../test_ws_llc_data_service.c | 33 ++++++++++++++----- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/test/nanostack/unittest/6LoWPAN/ws_llc_data_service/test_ws_llc_data_service.c b/test/nanostack/unittest/6LoWPAN/ws_llc_data_service/test_ws_llc_data_service.c index 35c696981e5..fa42d41d912 100644 --- a/test/nanostack/unittest/6LoWPAN/ws_llc_data_service/test_ws_llc_data_service.c +++ b/test/nanostack/unittest/6LoWPAN/ws_llc_data_service/test_ws_llc_data_service.c @@ -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) { @@ -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; @@ -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) {