From 161d537d5b1f60304e9ab3513c562c8fa05a6f32 Mon Sep 17 00:00:00 2001 From: Hasnain Virk Date: Wed, 27 Mar 2019 10:22:27 +0200 Subject: [PATCH] Unit test fix for RX TOA change The change had an impact on unittests and we needed to adjust the test cases a little to accomodate the change. --- UNITTESTS/features/lorawan/loramac/Test_LoRaMac.cpp | 3 +++ UNITTESTS/stubs/LoRaPHY_stub.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/UNITTESTS/features/lorawan/loramac/Test_LoRaMac.cpp b/UNITTESTS/features/lorawan/loramac/Test_LoRaMac.cpp index 2abe1cb4e6..04f0c3b91d 100644 --- a/UNITTESTS/features/lorawan/loramac/Test_LoRaMac.cpp +++ b/UNITTESTS/features/lorawan/loramac/Test_LoRaMac.cpp @@ -77,6 +77,9 @@ TEST_F(Test_LoRaMac, initialize) conn.connection_u.otaa.nb_trials = 2; object->prepare_join(&conn, true); + channel_params_t params[] = {868300000, 0, { ((DR_5 << 4) | DR_0) }, 1}; + LoRaPHY_stub::channel_params_ptr = params; + LoRaWANTimer_stub::call_cb_immediately = true; EXPECT_TRUE(LORAWAN_STATUS_OK == object->initialize(NULL, my_cb)); } diff --git a/UNITTESTS/stubs/LoRaPHY_stub.cpp b/UNITTESTS/stubs/LoRaPHY_stub.cpp index 5c0f8f53ec..1cb6542042 100644 --- a/UNITTESTS/stubs/LoRaPHY_stub.cpp +++ b/UNITTESTS/stubs/LoRaPHY_stub.cpp @@ -416,4 +416,8 @@ uint8_t LoRaPHY::apply_DR_offset(int8_t dr, int8_t dr_offset) return LoRaPHY_stub::uint8_value; } +uint32_t LoRaPHY::get_rx_time_on_air(uint8_t modem, uint16_t pkt_len) +{ + return LoRaPHY_stub::uint32_value; +}