Added tests
This commit is contained in:
parent
1b38f84edc
commit
4b62c8aa81
@ -18,4 +18,5 @@ add_subdirectory(serialize)
|
||||
add_subdirectory(datapoollocal)
|
||||
add_subdirectory(storagemanager)
|
||||
add_subdirectory(globalfunctions)
|
||||
add_subdirectory(timemanager)
|
||||
add_subdirectory(tmtcpacket)
|
||||
|
3
tests/src/fsfw_tests/unit/timemanager/CMakeLists.txt
Normal file
3
tests/src/fsfw_tests/unit/timemanager/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
||||
target_sources(${TARGET_NAME} PRIVATE
|
||||
TestCountdown.cpp
|
||||
)
|
27
tests/src/fsfw_tests/unit/timemanager/TestCountdown.cpp
Normal file
27
tests/src/fsfw_tests/unit/timemanager/TestCountdown.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||
#include <fsfw/timemanager/Countdown.h>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
|
||||
TEST_CASE( "Countdown Tests", "[TestCountdown]") {
|
||||
INFO("Countdown Tests");
|
||||
Countdown count(20);
|
||||
REQUIRE(count.timeout == 20);
|
||||
REQUIRE(count.setTimeout(100) == static_cast<uint16_t>(HasReturnvaluesIF::RETURN_OK));
|
||||
REQUIRE(count.timeout == 100);
|
||||
REQUIRE(count.setTimeout(150) == static_cast<uint16_t>(HasReturnvaluesIF::RETURN_OK));
|
||||
REQUIRE(count.isBusy());
|
||||
REQUIRE(not count.hasTimedOut());
|
||||
uint32_t number = count.getRemainingMillis();
|
||||
REQUIRE(number > 0);
|
||||
bool blocked = false;
|
||||
while(not count.hasTimedOut()){
|
||||
blocked = true;
|
||||
};
|
||||
REQUIRE(blocked);
|
||||
number = count.getRemainingMillis();
|
||||
REQUIRE(number==0);
|
||||
count.resetTimer();
|
||||
REQUIRE(not count.hasTimedOut());
|
||||
REQUIRE(count.isBusy());
|
||||
}
|
Loading…
Reference in New Issue
Block a user