Robin Mueller
ade15ad16d
This PR refactores the tests so they are built as part of the FSFW. This is done by adding Catch2 with the FetchContent directive. A future implementation might also use a system installation of Catch2 by first checking whether Catch2 can already be found as a package The custom configuration folder testcfg was moved from the user folder to the actual unittest folder. The tests can be built by setting the CMake FSFW_BUILD_UNITTESTS option to TRUE/ON. They are built with the static library and dropped inside the build folders fsfw directory.
46 lines
1.2 KiB
C++
46 lines
1.2 KiB
C++
#include "fsfw_tests/internal/InternalUnitTester.h"
|
|
#include "fsfw_tests/internal/UnittDefinitions.h"
|
|
|
|
#include "fsfw_tests/internal/osal/testMq.h"
|
|
#include "fsfw_tests/internal/osal/testSemaphore.h"
|
|
#include "fsfw_tests/internal/osal/testMutex.h"
|
|
#include "fsfw_tests/internal/serialize/IntTestSerialization.h"
|
|
#include "fsfw_tests/internal/globalfunctions/TestArrayPrinter.h"
|
|
|
|
#include <cstdlib>
|
|
|
|
InternalUnitTester::InternalUnitTester() {}
|
|
|
|
InternalUnitTester::~InternalUnitTester() {}
|
|
|
|
ReturnValue_t InternalUnitTester::performTests(
|
|
const struct InternalUnitTester::TestConfig& testConfig) {
|
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
|
sif::info << "Running internal unit tests.. Error messages might follow" <<
|
|
std::endl;
|
|
#else
|
|
sif::printInfo("Running internal unit tests..\n");
|
|
#endif
|
|
|
|
testserialize::test_serialization();
|
|
testmq::testMq();
|
|
if(testConfig.testSemaphores) {
|
|
testsemaph::testBinSemaph();
|
|
testsemaph::testCountingSemaph();
|
|
}
|
|
testmutex::testMutex();
|
|
if(testConfig.testArrayPrinter) {
|
|
arrayprinter::testArrayPrinter();
|
|
}
|
|
|
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
|
sif::info << "Internal unit tests finished." << std::endl;
|
|
#else
|
|
sif::printInfo("Internal unit tests finished.\n");
|
|
#endif
|
|
return RETURN_OK;
|
|
}
|
|
|
|
|
|
|