updated internal unit test

This commit is contained in:
Robin Müller 2021-01-15 16:56:36 +01:00
parent baba8fa5d7
commit 73b9d058e5
5 changed files with 31 additions and 7 deletions

View File

@ -5,24 +5,37 @@
#include "osal/IntTestSemaphore.h" #include "osal/IntTestSemaphore.h"
#include "osal/IntTestMutex.h" #include "osal/IntTestMutex.h"
#include "serialize/IntTestSerialization.h" #include "serialize/IntTestSerialization.h"
#include "globalfunctions/TestArrayPrinter.h"
#include <cstdlib> #include <cstdlib>
struct TestConfig {
bool testArrayPrinter;
};
InternalUnitTester::InternalUnitTester() {} InternalUnitTester::InternalUnitTester() {}
InternalUnitTester::~InternalUnitTester() {} InternalUnitTester::~InternalUnitTester() {}
ReturnValue_t InternalUnitTester::performTests() { ReturnValue_t InternalUnitTester::performTests(struct TestConfig testConfig) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "Running internal unit tests.." << std::endl; sif::info << "Running internal unit tests.." << std::endl;
#else
sif::printInfo("Running internal unit tests..\n");
#endif #endif
testserialize::test_serialization(); testserialize::test_serialization();
testmq::testMq(); testmq::testMq();
testsemaph::testBinSemaph(); testsemaph::testBinSemaph();
testsemaph::testCountingSemaph(); testsemaph::testCountingSemaph();
testmutex::testMutex(); testmutex::testMutex();
if(testConfig.testArrayPrinter) {
arrayprinter::testArrayPrinter();
}
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::info << "Internal unit tests finished." << std::endl; sif::info << "Internal unit tests finished." << std::endl;
#else
sif::printInfo("Running internal unit tests..\n");
#endif #endif
return RETURN_OK; return RETURN_OK;
} }

View File

@ -22,7 +22,7 @@ public:
* Some function which calls all other tests * Some function which calls all other tests
* @return * @return
*/ */
virtual ReturnValue_t performTests(); virtual ReturnValue_t performTests(struct TestConfig testConfig);
}; };

View File

@ -0,0 +1,4 @@
#include "TestArrayPrinter.cpp"
void arrayprinter::testArrayPrinter() {
}

View File

@ -0,0 +1,12 @@
#ifndef FSFW_UNITTEST_INTERNAL_GLOBALFUNCTIONS_TESTARRAYPRINTER_H_
#define FSFW_UNITTEST_INTERNAL_GLOBALFUNCTIONS_TESTARRAYPRINTER_H_
namespace arrayprinter {
void testArrayPrinter();
}
#endif /* FSFW_UNITTEST_INTERNAL_GLOBALFUNCTIONS_TESTARRAYPRINTER_H_ */

View File

@ -1,5 +0,0 @@
#include <catch2/catch_test_macros.hpp>