Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Test_LoRaWANTimer.cpp
00001 /* 00002 * Copyright (c) 2018, Arm Limited and affiliates 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #include "gtest/gtest.h" 00019 #include "LoRaWANTimer.h" 00020 00021 using namespace events; 00022 00023 class Test_LoRaWANTimer : public testing::Test { 00024 protected: 00025 LoRaWANTimeHandler *object; 00026 EventQueue *queue; 00027 00028 virtual void SetUp() 00029 { 00030 queue = new EventQueue(3, NULL); 00031 object = new LoRaWANTimeHandler(); 00032 object->activate_timer_subsystem(queue); 00033 } 00034 00035 virtual void TearDown() 00036 { 00037 delete object; 00038 delete queue; 00039 } 00040 }; 00041 00042 TEST_F(Test_LoRaWANTimer, constructor) 00043 { 00044 EXPECT_TRUE(object); 00045 } 00046 00047 TEST_F(Test_LoRaWANTimer, get_current_time) 00048 { 00049 lorawan_time_t tt = object->get_current_time(); 00050 EXPECT_TRUE(0 == tt); 00051 } 00052 00053 TEST_F(Test_LoRaWANTimer, get_elapsed_time) 00054 { 00055 lorawan_time_t tt = object->get_elapsed_time(0); 00056 EXPECT_TRUE(0 == tt); 00057 } 00058 00059 void my_callback() 00060 { 00061 } 00062 00063 TEST_F(Test_LoRaWANTimer, init) 00064 { 00065 timer_event_t ev; 00066 object->init(ev, my_callback); 00067 } 00068 00069 TEST_F(Test_LoRaWANTimer, start) 00070 { 00071 timer_event_t ev; 00072 object->start(ev, 10); 00073 } 00074 00075 TEST_F(Test_LoRaWANTimer, stop) 00076 { 00077 timer_event_t ev; 00078 ev.timer_id = 4; 00079 object->stop(ev); 00080 EXPECT_TRUE(ev.timer_id == 0); 00081 } 00082 00083 00084
Generated on Tue Aug 9 2022 00:37:22 by
1.7.2