more checks

This commit is contained in:
Robin Müller 2023-08-14 12:19:55 +02:00
parent b094ba145f
commit e4aae75747
Signed by: muellerr
GPG Key ID: 407F9B00F858F270
3 changed files with 6 additions and 4 deletions

View File

@ -353,8 +353,8 @@ cfdp::CfdpState cfdp::SourceHandler::getState() const { return state; }
cfdp::SourceHandler::TransactionStep cfdp::SourceHandler::getStep() const { return step; }
void cfdp::SourceHandler::addError(ReturnValue_t error) {
if (errorIndex < fsmResult.errorCodes.size()) {
fsmResult.errorCodes[errorIndex] = error;
errorIndex++;
if (fsmResult.errors < fsmResult.errorCodes.size()) {
fsmResult.errorCodes[fsmResult.errors] = error;
fsmResult.errors++;
}
}

View File

@ -92,7 +92,6 @@ class SourceHandler {
std::array<uint8_t, 4096> fileBuf{};
SourceHandlerParams sourceParams;
cfdp::FsfwParams fsfwParams;
uint8_t errorIndex = 0;
FsmResult fsmResult;
FsmResult& fsmNacked();

View File

@ -66,6 +66,7 @@ TEST_CASE("CFDP Source Handler", "[cfdp]") {
auto onePduSentCheck = [&](SourceHandler::FsmResult& fsmResult, TmTcMessage& tmtcMessage,
const uint8_t** pduPtr) {
CHECK(fsmResult.errors == 0);
CHECK(fsmResult.packetsSent == 1);
CHECK(mqMock.numberOfSentMessages() == 1);
REQUIRE(mqMock.getNextSentMessage(destQueueId, tmtcMessage) == OK);
@ -75,6 +76,7 @@ TEST_CASE("CFDP Source Handler", "[cfdp]") {
return std::move(accessor);
};
auto genericMetadataCheck = [&](SourceHandler::FsmResult& fsmResult, size_t expectedFileSize) {
CHECK(fsmResult.errors == 0);
TmTcMessage tmtcMessage;
const uint8_t* pduPtr;
auto accessor = onePduSentCheck(fsmResult, tmtcMessage, &pduPtr);
@ -97,6 +99,7 @@ TEST_CASE("CFDP Source Handler", "[cfdp]") {
};
auto genericEofCheck = [&](SourceHandler::FsmResult& fsmResult, size_t expectedFileSize,
uint32_t expectedChecksum) {
CHECK(fsmResult.errors == 0);
TmTcMessage tmtcMessage;
const uint8_t* pduPtr;
auto accessor = onePduSentCheck(fsmResult, tmtcMessage, &pduPtr);