Merge branch 'development' into mueller/new-cicd-cmake-opts
This commit is contained in:
@ -13,14 +13,14 @@ TestDevice::TestDevice(object_id_t objectId, object_id_t comIF, CookieIF* cookie
|
||||
dataset(this),
|
||||
fullInfoPrintout(fullInfoPrintout) {}
|
||||
|
||||
TestDevice::~TestDevice() {}
|
||||
TestDevice::~TestDevice() = default;
|
||||
|
||||
void TestDevice::performOperationHook() {
|
||||
if (periodicPrintout) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "TestDevice" << deviceIdx << "::performOperationHook: Alive!" << std::endl;
|
||||
#else
|
||||
sif::printInfo("TestDevice%d::performOperationHook: Alive!", deviceIdx);
|
||||
sif::printInfo("TestDevice%d::performOperationHook: Alive!\n", deviceIdx);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ TestTask::TestTask(object_id_t objectId) : SystemObject(objectId), testMode(test
|
||||
IPCStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
||||
}
|
||||
|
||||
TestTask::~TestTask() {}
|
||||
TestTask::~TestTask() = default;
|
||||
|
||||
ReturnValue_t TestTask::performOperation(uint8_t operationCode) {
|
||||
ReturnValue_t result = RETURN_OK;
|
||||
|
@ -13,9 +13,9 @@
|
||||
*/
|
||||
class TestTask : public SystemObject, public ExecutableObjectIF, public HasReturnvaluesIF {
|
||||
public:
|
||||
TestTask(object_id_t objectId);
|
||||
virtual ~TestTask();
|
||||
virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
||||
explicit TestTask(object_id_t objectId);
|
||||
~TestTask() override;
|
||||
ReturnValue_t performOperation(uint8_t operationCode) override;
|
||||
|
||||
protected:
|
||||
virtual ReturnValue_t performOneShotAction();
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "fsfw_tests/unit/mocks/PeriodicTaskIFMock.h"
|
||||
|
||||
TEST_CASE("Internal Error Reporter", "[TestInternalError]") {
|
||||
PeriodicTaskMock task(10);
|
||||
PeriodicTaskMock task(10, nullptr);
|
||||
ObjectManagerIF* manager = ObjectManager::instance();
|
||||
if (manager == nullptr) {
|
||||
FAIL();
|
||||
@ -27,6 +27,8 @@ TEST_CASE("Internal Error Reporter", "[TestInternalError]") {
|
||||
FAIL();
|
||||
}
|
||||
task.addComponent(objects::INTERNAL_ERROR_REPORTER);
|
||||
// This calls the initializeAfterTaskCreation function
|
||||
task.startTask();
|
||||
MessageQueueIF* testQueue = QueueFactory::instance()->createMessageQueue(1);
|
||||
MessageQueueIF* hkQueue = QueueFactory::instance()->createMessageQueue(1);
|
||||
internalErrorReporter->getSubscriptionInterface()->subscribeForSetUpdateMessage(
|
||||
@ -115,4 +117,4 @@ TEST_CASE("Internal Error Reporter", "[TestInternalError]") {
|
||||
}
|
||||
QueueFactory::instance()->deleteMessageQueue(testQueue);
|
||||
QueueFactory::instance()->deleteMessageQueue(hkQueue);
|
||||
}
|
||||
}
|
||||
|
@ -2,36 +2,24 @@
|
||||
#define FSFW_UNITTEST_TESTS_MOCKS_PERIODICTASKMOCK_H_
|
||||
|
||||
#include <fsfw/tasks/ExecutableObjectIF.h>
|
||||
#include <fsfw/tasks/PeriodicTaskIF.h>
|
||||
#include <fsfw/tasks/PeriodicTaskBase.h>
|
||||
|
||||
class PeriodicTaskMock : public PeriodicTaskIF {
|
||||
class PeriodicTaskMock : public PeriodicTaskBase {
|
||||
public:
|
||||
PeriodicTaskMock(uint32_t period = 5) : period(period) {}
|
||||
/**
|
||||
* @brief A virtual destructor as it is mandatory for interfaces.
|
||||
*/
|
||||
PeriodicTaskMock(TaskPeriod period, TaskDeadlineMissedFunction dlmFunc)
|
||||
: PeriodicTaskBase(period, dlmFunc) {}
|
||||
|
||||
virtual ~PeriodicTaskMock() {}
|
||||
/**
|
||||
* @brief With the startTask method, a created task can be started
|
||||
* for the first time.
|
||||
*/
|
||||
virtual ReturnValue_t startTask() override { return HasReturnvaluesIF::RETURN_OK; };
|
||||
|
||||
virtual ReturnValue_t addComponent(object_id_t object) override {
|
||||
ExecutableObjectIF* executableObject =
|
||||
ObjectManager::instance()->get<ExecutableObjectIF>(objects::INTERNAL_ERROR_REPORTER);
|
||||
if (executableObject == nullptr) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
executableObject->setTaskIF(this);
|
||||
executableObject->initializeAfterTaskCreation();
|
||||
virtual ReturnValue_t startTask() override {
|
||||
initObjsAfterTaskCreation();
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
};
|
||||
|
||||
virtual ReturnValue_t sleepFor(uint32_t ms) override { return HasReturnvaluesIF::RETURN_OK; };
|
||||
|
||||
virtual uint32_t getPeriodMs() const override { return period; };
|
||||
uint32_t period;
|
||||
};
|
||||
|
||||
#endif // FSFW_UNITTEST_TESTS_MOCKS_PERIODICTASKMOCK_H_
|
||||
#endif // FSFW_UNITTEST_TESTS_MOCKS_PERIODICTASKMOCK_H_
|
||||
|
Reference in New Issue
Block a user