From a1d8b3d39c0608433806e9fd3a6965fac1d50409 Mon Sep 17 00:00:00 2001 From: Jarkko Paso Date: Fri, 26 Oct 2018 14:32:10 +0300 Subject: [PATCH] FHSS unit tests: Fixed tr51 tests --- .../channel_functions/test_channel_functions.c | 11 ++++++++--- .../unittest/service_libs/fhss_ws/test_fhss_ws.c | 3 ++- test/nanostack/unittest/stub/channel_functions_stub.c | 9 +++++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/test/nanostack/unittest/service_libs/channel_functions/test_channel_functions.c b/test/nanostack/unittest/service_libs/channel_functions/test_channel_functions.c index 843fafc085a..25b00a562ad 100644 --- a/test/nanostack/unittest/service_libs/channel_functions/test_channel_functions.c +++ b/test/nanostack/unittest/service_libs/channel_functions/test_channel_functions.c @@ -86,10 +86,13 @@ bool test_tr51_get_uc_channel_index() int i; uint16_t number_of_channels = 129; int32_t channel; + int16_t channel_table[number_of_channels]; int32_t test_table[number_of_channels]; uint8_t mac[8] = {0x00, 0x13, 0x50, 0x04, 0x00, 0x00, 0x05, 0xf8}; + + tr51_init_channel_table(channel_table, number_of_channels); for (i=0; itr51_channel_table); free(fhss_common_stub.fhss_struct.ws); return true; } diff --git a/test/nanostack/unittest/stub/channel_functions_stub.c b/test/nanostack/unittest/stub/channel_functions_stub.c index 6c2bde5bdce..2495bf3ab73 100644 --- a/test/nanostack/unittest/stub/channel_functions_stub.c +++ b/test/nanostack/unittest/stub/channel_functions_stub.c @@ -30,13 +30,18 @@ int32_t dh1cf_get_bc_channel_index(uint16_t slot_number, uint16_t bsi, int16_t n return 2; } -int32_t tr51_get_uc_channel_index(uint16_t slot_number, uint8_t *mac, int16_t number_of_channels) +int tr51_init_channel_table(int16_t *channel_table, int16_t number_of_channels) +{ + return 0; +} + +int32_t tr51_get_uc_channel_index(int16_t *channel_table, uint16_t slot_number, uint8_t *mac, int16_t number_of_channels) { channel_functions_stub.uint8_value = slot_number; return 3; } -int32_t tr51_get_bc_channel_index(uint16_t slot_number, uint16_t bsi, int16_t number_of_channels) +int32_t tr51_get_bc_channel_index(int16_t *channel_table, uint16_t slot_number, uint16_t bsi, int16_t number_of_channels) { return 4; }