Unit test for Internal Error Reporter #563
@ -3,6 +3,7 @@
|
|||||||
#include <fsfw/internalerror/InternalErrorReporter.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>
|
||||||
@ -34,6 +35,7 @@ TEST_CASE("Internal Error Reporter", "[TestInternalError]") {
|
|||||||
auto result = hkQueue->sendMessage(testQueue->getId(), &message);
|
auto result = hkQueue->sendMessage(testQueue->getId(), &message);
|
||||||
REQUIRE(result == retval::CATCH_OK);
|
REQUIRE(result == retval::CATCH_OK);
|
||||||
internalErrorReporter->performOperation(0);
|
internalErrorReporter->performOperation(0);
|
||||||
|
uint32_t queueHits = 0;
|
||||||
{
|
{
|
||||||
CommandMessage hkMessage;
|
CommandMessage hkMessage;
|
||||||
result = hkQueue->receiveMessage(&hkMessage);
|
result = hkQueue->receiveMessage(&hkMessage);
|
||||||
@ -45,10 +47,13 @@ TEST_CASE("Internal Error Reporter", "[TestInternalError]") {
|
|||||||
InternalErrorDataset dataset(objects::NO_OBJECT);
|
InternalErrorDataset dataset(objects::NO_OBJECT);
|
||||||
CCSDSTime::CDS_short time;
|
CCSDSTime::CDS_short time;
|
||||||
ConstAccessorPair data = ipcStore->getData(storeAddress);
|
ConstAccessorPair data = ipcStore->getData(storeAddress);
|
||||||
|
REQUIRE(data.first == HasReturnvaluesIF::RETURN_OK);
|
||||||
HousekeepingSnapshot hkSnapshot(&time, &dataset);
|
HousekeepingSnapshot hkSnapshot(&time, &dataset);
|
||||||
const uint8_t* buffer = data.second.data();
|
const uint8_t* buffer = data.second.data();
|
||||||
size_t size = data.second.size();
|
size_t size = data.second.size();
|
||||||
hkSnapshot.deSerialize(&buffer, &size, SerializeIF::Endianness::MACHINE);
|
result = hkSnapshot.deSerialize(&buffer, &size, SerializeIF::Endianness::MACHINE);
|
||||||
|
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
||||||
|
queueHits = dataset.queueHits.value;
|
||||||
}
|
}
|
||||||
result = hkQueue->sendMessage(testQueue->getId(), &message);
|
result = hkQueue->sendMessage(testQueue->getId(), &message);
|
||||||
REQUIRE(result == MessageQueueIF::FULL);
|
REQUIRE(result == MessageQueueIF::FULL);
|
||||||
@ -64,6 +69,14 @@ TEST_CASE("Internal Error Reporter", "[TestInternalError]") {
|
|||||||
|
|
||||||
ConstAccessorPair data = ipcStore->getData(storeAddress);
|
ConstAccessorPair data = ipcStore->getData(storeAddress);
|
||||||
REQUIRE(data.first == HasReturnvaluesIF::RETURN_OK);
|
REQUIRE(data.first == HasReturnvaluesIF::RETURN_OK);
|
||||||
|
CCSDSTime::CDS_short time;
|
||||||
|
InternalErrorDataset dataset(objects::NO_OBJECT);
|
||||||
|
HousekeepingSnapshot hkSnapshot(&time, &dataset);
|
||||||
|
const uint8_t* buffer = data.second.data();
|
||||||
|
size_t size = data.second.size();
|
||||||
|
result = hkSnapshot.deSerialize(&buffer, &size, SerializeIF::Endianness::MACHINE);
|
||||||
|
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
||||||
|
REQUIRE(dataset.queueHits == (queueHits + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete testQueue;
|
delete testQueue;
|
||||||
|
Loading…
Reference in New Issue
Block a user