Clang format
This commit is contained in:
parent
a50b52df51
commit
4862edfdb5
@ -57,7 +57,7 @@ ReturnValue_t InternalErrorReporter::performOperation(uint8_t opCode) {
|
|||||||
internalErrorDataset.storeHits.value += newStoreHits;
|
internalErrorDataset.storeHits.value += newStoreHits;
|
||||||
internalErrorDataset.tmHits.value += newTmHits;
|
internalErrorDataset.tmHits.value += newTmHits;
|
||||||
internalErrorDataset.setValidity(true, true);
|
internalErrorDataset.setValidity(true, true);
|
||||||
if((newQueueHits != 0) or (newStoreHits !=0) or (newTmHits != 0)){
|
if ((newQueueHits != 0) or (newStoreHits != 0) or (newTmHits != 0)) {
|
||||||
internalErrorDataset.setChanged(true);
|
internalErrorDataset.setChanged(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
#include <fsfw/housekeeping/HousekeepingSnapshot.h>
|
||||||
|
#include <fsfw/internalerror/InternalErrorReporter.h>
|
||||||
#include <fsfw/ipc/MessageQueueIF.h>
|
#include <fsfw/ipc/MessageQueueIF.h>
|
||||||
#include <fsfw/ipc/QueueFactory.h>
|
#include <fsfw/ipc/QueueFactory.h>
|
||||||
#include <fsfw/internalerror/InternalErrorReporter.h>
|
|
||||||
#include <fsfw/objectmanager/ObjectManager.h>
|
#include <fsfw/objectmanager/ObjectManager.h>
|
||||||
#include <fsfw/timemanager/CCSDSTime.h>
|
#include <fsfw/timemanager/CCSDSTime.h>
|
||||||
#include <fsfw/housekeeping/HousekeepingSnapshot.h>
|
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
@ -18,21 +18,21 @@
|
|||||||
TEST_CASE("Internal Error Reporter", "[TestInternalError]") {
|
TEST_CASE("Internal Error Reporter", "[TestInternalError]") {
|
||||||
PeriodicTaskMock task(10);
|
PeriodicTaskMock task(10);
|
||||||
ObjectManagerIF* manager = ObjectManager::instance();
|
ObjectManagerIF* manager = ObjectManager::instance();
|
||||||
if(manager == nullptr){
|
if (manager == nullptr) {
|
||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
InternalErrorReporter* internalErrorReporter =
|
InternalErrorReporter* internalErrorReporter = dynamic_cast<InternalErrorReporter*>(
|
||||||
dynamic_cast<InternalErrorReporter*>(ObjectManager::instance()->get<InternalErrorReporterIF>(objects::INTERNAL_ERROR_REPORTER));
|
ObjectManager::instance()->get<InternalErrorReporterIF>(objects::INTERNAL_ERROR_REPORTER));
|
||||||
if(internalErrorReporter == nullptr){
|
if (internalErrorReporter == nullptr) {
|
||||||
FAIL();
|
FAIL();
|
||||||
}
|
}
|
||||||
task.addComponent(objects::INTERNAL_ERROR_REPORTER);
|
task.addComponent(objects::INTERNAL_ERROR_REPORTER);
|
||||||
MessageQueueIF* testQueue = QueueFactory::instance()->createMessageQueue(1);
|
MessageQueueIF* testQueue = QueueFactory::instance()->createMessageQueue(1);
|
||||||
MessageQueueIF* hkQueue = QueueFactory::instance()->createMessageQueue(1);
|
MessageQueueIF* hkQueue = QueueFactory::instance()->createMessageQueue(1);
|
||||||
internalErrorReporter->getSubscriptionInterface()->
|
internalErrorReporter->getSubscriptionInterface()->subscribeForSetUpdateMessage(
|
||||||
subscribeForSetUpdateMessage(InternalErrorDataset::ERROR_SET_ID, objects::NO_OBJECT, hkQueue->getId(), true);
|
InternalErrorDataset::ERROR_SET_ID, objects::NO_OBJECT, hkQueue->getId(), true);
|
||||||
StorageManagerIF* ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
StorageManagerIF* ipcStore = ObjectManager::instance()->get<StorageManagerIF>(objects::IPC_STORE);
|
||||||
SECTION("MessageQueueFull"){
|
SECTION("MessageQueueFull") {
|
||||||
CommandMessage message;
|
CommandMessage message;
|
||||||
ActionMessage::setCompletionReply(&message, 10, true);
|
ActionMessage::setCompletionReply(&message, 10, true);
|
||||||
auto result = hkQueue->sendMessage(testQueue->getId(), &message);
|
auto result = hkQueue->sendMessage(testQueue->getId(), &message);
|
||||||
@ -50,7 +50,8 @@ TEST_CASE("Internal Error Reporter", "[TestInternalError]") {
|
|||||||
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
||||||
REQUIRE(hkMessage.getCommand() == HousekeepingMessage::UPDATE_SNAPSHOT_SET);
|
REQUIRE(hkMessage.getCommand() == HousekeepingMessage::UPDATE_SNAPSHOT_SET);
|
||||||
store_address_t storeAddress;
|
store_address_t storeAddress;
|
||||||
gp_id_t gpid = HousekeepingMessage::getUpdateSnapshotVariableCommand(&hkMessage, &storeAddress);
|
gp_id_t gpid =
|
||||||
|
HousekeepingMessage::getUpdateSnapshotVariableCommand(&hkMessage, &storeAddress);
|
||||||
REQUIRE(gpid.objectId == objects::INTERNAL_ERROR_REPORTER);
|
REQUIRE(gpid.objectId == objects::INTERNAL_ERROR_REPORTER);
|
||||||
// We need the object ID of the reporter here (NO_OBJECT)
|
// We need the object ID of the reporter here (NO_OBJECT)
|
||||||
InternalErrorDataset dataset(objects::INTERNAL_ERROR_REPORTER);
|
InternalErrorDataset dataset(objects::INTERNAL_ERROR_REPORTER);
|
||||||
@ -78,7 +79,8 @@ TEST_CASE("Internal Error Reporter", "[TestInternalError]") {
|
|||||||
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
||||||
REQUIRE(hkMessage.getCommand() == HousekeepingMessage::UPDATE_SNAPSHOT_SET);
|
REQUIRE(hkMessage.getCommand() == HousekeepingMessage::UPDATE_SNAPSHOT_SET);
|
||||||
store_address_t storeAddress;
|
store_address_t storeAddress;
|
||||||
gp_id_t gpid = HousekeepingMessage::getUpdateSnapshotVariableCommand(&hkMessage, &storeAddress);
|
gp_id_t gpid =
|
||||||
|
HousekeepingMessage::getUpdateSnapshotVariableCommand(&hkMessage, &storeAddress);
|
||||||
REQUIRE(gpid.objectId == objects::INTERNAL_ERROR_REPORTER);
|
REQUIRE(gpid.objectId == objects::INTERNAL_ERROR_REPORTER);
|
||||||
|
|
||||||
ConstAccessorPair data = ipcStore->getData(storeAddress);
|
ConstAccessorPair data = ipcStore->getData(storeAddress);
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
#ifndef FSFW_UNITTEST_TESTS_MOCKS_PERIODICTASKMOCK_H_
|
#ifndef FSFW_UNITTEST_TESTS_MOCKS_PERIODICTASKMOCK_H_
|
||||||
#define FSFW_UNITTEST_TESTS_MOCKS_PERIODICTASKMOCK_H_
|
#define FSFW_UNITTEST_TESTS_MOCKS_PERIODICTASKMOCK_H_
|
||||||
|
|
||||||
#include <fsfw/tasks/PeriodicTaskIF.h>
|
|
||||||
#include <fsfw/tasks/ExecutableObjectIF.h>
|
#include <fsfw/tasks/ExecutableObjectIF.h>
|
||||||
|
#include <fsfw/tasks/PeriodicTaskIF.h>
|
||||||
|
|
||||||
class PeriodicTaskMock: public PeriodicTaskIF{
|
class PeriodicTaskMock : public PeriodicTaskIF {
|
||||||
public:
|
public:
|
||||||
PeriodicTaskMock(uint32_t period = 5):period(period){
|
PeriodicTaskMock(uint32_t period = 5) : period(period) {}
|
||||||
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* @brief A virtual destructor as it is mandatory for interfaces.
|
* @brief A virtual destructor as it is mandatory for interfaces.
|
||||||
*/
|
*/
|
||||||
@ -17,13 +15,12 @@ public:
|
|||||||
* @brief With the startTask method, a created task can be started
|
* @brief With the startTask method, a created task can be started
|
||||||
* for the first time.
|
* for the first time.
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t startTask() override{
|
virtual ReturnValue_t startTask() override { return HasReturnvaluesIF::RETURN_OK; };
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual ReturnValue_t addComponent(object_id_t object) override{
|
virtual ReturnValue_t addComponent(object_id_t object) override {
|
||||||
ExecutableObjectIF* executableObject = ObjectManager::instance()->get<ExecutableObjectIF>(objects::INTERNAL_ERROR_REPORTER);
|
ExecutableObjectIF* executableObject =
|
||||||
if(executableObject == nullptr){
|
ObjectManager::instance()->get<ExecutableObjectIF>(objects::INTERNAL_ERROR_REPORTER);
|
||||||
|
if (executableObject == nullptr) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
executableObject->setTaskIF(this);
|
executableObject->setTaskIF(this);
|
||||||
@ -31,15 +28,10 @@ public:
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual ReturnValue_t sleepFor(uint32_t ms) override{
|
virtual ReturnValue_t sleepFor(uint32_t ms) override { return HasReturnvaluesIF::RETURN_OK; };
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
};
|
|
||||||
|
|
||||||
virtual uint32_t getPeriodMs() const override{
|
virtual uint32_t getPeriodMs() const override { return period; };
|
||||||
return period;
|
|
||||||
};
|
|
||||||
uint32_t period;
|
uint32_t period;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // FSFW_UNITTEST_TESTS_MOCKS_PERIODICTASKMOCK_H_
|
#endif // FSFW_UNITTEST_TESTS_MOCKS_PERIODICTASKMOCK_H_
|
Loading…
x
Reference in New Issue
Block a user