more checks

This commit is contained in:
2023-08-14 13:33:47 +02:00
parent b7056a7467
commit cd8d64830c
3 changed files with 16 additions and 7 deletions

View File

@ -33,7 +33,7 @@ TEST_CASE("CFDP Source Handler", "[cfdp]") {
AcceptsTmMock tmReceiver(destQueueId);
MessageQueueMock mqMock(destQueueId);
EntityId localId = EntityId(UnsignedByteField<uint16_t>(2));
EntityId remoteId = EntityId(UnsignedByteField<uint16_t>(3));
EntityId remoteId = EntityId(UnsignedByteField<uint16_t>(5));
FaultHandlerMock fhMock;
LocalEntityCfg localEntityCfg(localId, IndicationCfg(), fhMock);
FilesystemMock fsMock;
@ -52,8 +52,7 @@ TEST_CASE("CFDP Source Handler", "[cfdp]") {
RemoteEntityCfg cfg;
cfg.maxFileSegmentLen = MAX_FILE_SEGMENT_SIZE;
EntityId id(cfdp::WidthInBytes::TWO_BYTES, 5);
cfg.remoteId = id;
cfg.remoteId = remoteId;
std::string srcFileName = "/tmp/cfdp-test.txt";
std::string destFileName = "/tmp/cfdp-test2.txt";
FilesystemParams srcFileNameFs(srcFileName.c_str());
@ -61,7 +60,7 @@ TEST_CASE("CFDP Source Handler", "[cfdp]") {
cfdp::StringLv srcNameLv(srcFileNameFs.path, std::strlen(srcFileNameFs.path));
FilesystemParams destFileNameFs(destFileName.c_str());
cfdp::StringLv destNameLv(destFileNameFs.path, std::strlen(destFileNameFs.path));
PutRequest putRequest(id, srcNameLv, destNameLv);
PutRequest putRequest(remoteId, srcNameLv, destNameLv);
CHECK(sourceHandler.initialize() == OK);
auto onePduSentCheck = [&](SourceHandler::FsmResult& fsmResult, TmTcMessage& tmtcMessage,
@ -90,6 +89,14 @@ TEST_CASE("CFDP Source Handler", "[cfdp]") {
TransactionSeqNum seqNum;
metadataReader.getTransactionSeqNum(seqNum);
CHECK(seqNum.getValue() == expectedSeqNum);
CHECK(userMock.transactionIndicRecvd.size() == 1);
CHECK(userMock.transactionIndicRecvd.back() == TransactionId(localId, seqNum));
EntityId srcId;
metadataReader.getSourceId(srcId);
EntityId destId;
metadataReader.getDestId(destId);
CHECK(srcId.getValue() == localId.getValue());
CHECK(destId.getValue() == remoteId.getValue());
std::string destNameRead = metadataReader.getDestFileName().getString();
CHECK(destNameRead == destFileName);
if (expectedFileSize == 0) {