CFDP SOURCE handler #157
@ -75,7 +75,8 @@ TEST_CASE("CFDP Source Handler", "[cfdp]") {
|
|||||||
*pduPtr = accessor.second.data();
|
*pduPtr = accessor.second.data();
|
||||||
return std::move(accessor);
|
return std::move(accessor);
|
||||||
};
|
};
|
||||||
auto genericMetadataCheck = [&](SourceHandler::FsmResult& fsmResult, size_t expectedFileSize) {
|
auto genericMetadataCheck = [&](SourceHandler::FsmResult& fsmResult, size_t expectedFileSize,
|
||||||
|
uint16_t expectedSeqNum) {
|
||||||
CHECK(fsmResult.errors == 0);
|
CHECK(fsmResult.errors == 0);
|
||||||
TmTcMessage tmtcMessage;
|
TmTcMessage tmtcMessage;
|
||||||
const uint8_t* pduPtr;
|
const uint8_t* pduPtr;
|
||||||
@ -86,6 +87,9 @@ TEST_CASE("CFDP Source Handler", "[cfdp]") {
|
|||||||
REQUIRE(metadataReader.parseData() == OK);
|
REQUIRE(metadataReader.parseData() == OK);
|
||||||
std::string srcNameRead = metadataReader.getSourceFileName().getString();
|
std::string srcNameRead = metadataReader.getSourceFileName().getString();
|
||||||
CHECK(srcNameRead == srcFileName);
|
CHECK(srcNameRead == srcFileName);
|
||||||
|
TransactionSeqNum seqNum;
|
||||||
|
metadataReader.getTransactionSeqNum(seqNum);
|
||||||
|
CHECK(seqNum.getValue() == expectedSeqNum);
|
||||||
std::string destNameRead = metadataReader.getDestFileName().getString();
|
std::string destNameRead = metadataReader.getDestFileName().getString();
|
||||||
CHECK(destNameRead == destFileName);
|
CHECK(destNameRead == destFileName);
|
||||||
if (expectedFileSize == 0) {
|
if (expectedFileSize == 0) {
|
||||||
@ -124,7 +128,7 @@ TEST_CASE("CFDP Source Handler", "[cfdp]") {
|
|||||||
size_t expectedFileSize = 0;
|
size_t expectedFileSize = 0;
|
||||||
SourceHandler::FsmResult& fsmResult = sourceHandler.stateMachine();
|
SourceHandler::FsmResult& fsmResult = sourceHandler.stateMachine();
|
||||||
// Verify metadata PDU was sent.
|
// Verify metadata PDU was sent.
|
||||||
genericMetadataCheck(fsmResult, expectedFileSize);
|
genericMetadataCheck(fsmResult, expectedFileSize, 0);
|
||||||
|
|
||||||
fsmResult = sourceHandler.stateMachine();
|
fsmResult = sourceHandler.stateMachine();
|
||||||
// Verify EOF PDU was sent. No file data PDU is sent for an empty file and the checksum is 0.
|
// Verify EOF PDU was sent. No file data PDU is sent for an empty file and the checksum is 0.
|
||||||
@ -144,7 +148,7 @@ TEST_CASE("CFDP Source Handler", "[cfdp]") {
|
|||||||
SourceHandler::FsmResult& fsmResult = sourceHandler.stateMachine();
|
SourceHandler::FsmResult& fsmResult = sourceHandler.stateMachine();
|
||||||
|
|
||||||
// Verify metadata PDU was sent.
|
// Verify metadata PDU was sent.
|
||||||
genericMetadataCheck(fsmResult, expectedFileSize);
|
genericMetadataCheck(fsmResult, expectedFileSize, 0);
|
||||||
|
|
||||||
// Verify that a small file data PDU was sent.
|
// Verify that a small file data PDU was sent.
|
||||||
fsmResult = sourceHandler.stateMachine();
|
fsmResult = sourceHandler.stateMachine();
|
||||||
@ -193,7 +197,7 @@ TEST_CASE("CFDP Source Handler", "[cfdp]") {
|
|||||||
CHECK(sourceHandler.transactionStart(putRequest, cfg) == OK);
|
CHECK(sourceHandler.transactionStart(putRequest, cfg) == OK);
|
||||||
SourceHandler::FsmResult& fsmResult = sourceHandler.stateMachine();
|
SourceHandler::FsmResult& fsmResult = sourceHandler.stateMachine();
|
||||||
// Verify metadata PDU was sent.
|
// Verify metadata PDU was sent.
|
||||||
genericMetadataCheck(fsmResult, expectedFileSize);
|
genericMetadataCheck(fsmResult, expectedFileSize, 0);
|
||||||
|
|
||||||
// Check first file data PDU. It should have the maximum file segment size.
|
// Check first file data PDU. It should have the maximum file segment size.
|
||||||
fsmResult = sourceHandler.stateMachine();
|
fsmResult = sourceHandler.stateMachine();
|
||||||
|
Loading…
Reference in New Issue
Block a user