empty file unittest complete
This commit is contained in:
parent
428da017ba
commit
ba046cebd9
@ -85,12 +85,12 @@ TEST_CASE("CFDP Dest Handler", "[cfdp]") {
|
|||||||
REQUIRE(packetInfoList.empty());
|
REQUIRE(packetInfoList.empty());
|
||||||
destHandler.performStateMachine();
|
destHandler.performStateMachine();
|
||||||
REQUIRE(userMock.metadataRecvd.size() == 1);
|
REQUIRE(userMock.metadataRecvd.size() == 1);
|
||||||
MetadataRecvdParams& params = userMock.metadataRecvd.back();
|
auto& idMetadataPair = userMock.metadataRecvd.back();
|
||||||
REQUIRE(params.id == destHandler.getTransactionId());
|
REQUIRE(idMetadataPair.first == destHandler.getTransactionId());
|
||||||
REQUIRE(params.sourceId.getValue() == 3);
|
REQUIRE(idMetadataPair.second.sourceId.getValue() == 3);
|
||||||
REQUIRE(params.fileSize == 0);
|
REQUIRE(idMetadataPair.second.fileSize == 0);
|
||||||
REQUIRE(strcmp(params.destFileName, "hello-cpy.txt") == 0);
|
REQUIRE(strcmp(idMetadataPair.second.destFileName, "hello-cpy.txt") == 0);
|
||||||
REQUIRE(strcmp(params.sourceFileName, "hello.txt") == 0);
|
REQUIRE(strcmp(idMetadataPair.second.sourceFileName, "hello.txt") == 0);
|
||||||
userMock.metadataRecvd.pop();
|
userMock.metadataRecvd.pop();
|
||||||
REQUIRE(fsMock.fileMap.find("hello-cpy.txt") != fsMock.fileMap.end());
|
REQUIRE(fsMock.fileMap.find("hello-cpy.txt") != fsMock.fileMap.end());
|
||||||
REQUIRE(res.result == OK);
|
REQUIRE(res.result == OK);
|
||||||
@ -115,6 +115,10 @@ TEST_CASE("CFDP Dest Handler", "[cfdp]") {
|
|||||||
REQUIRE(userMock.eofsRevd.size() == 1);
|
REQUIRE(userMock.eofsRevd.size() == 1);
|
||||||
auto& eofId = userMock.eofsRevd.back();
|
auto& eofId = userMock.eofsRevd.back();
|
||||||
CHECK(eofId == transactionId);
|
CHECK(eofId == transactionId);
|
||||||
|
REQUIRE(userMock.finishedRecvd.size() == 1);
|
||||||
|
auto& idParamPair = userMock.finishedRecvd.back();
|
||||||
|
CHECK(idParamPair.first == transactionId);
|
||||||
|
CHECK(idParamPair.second.condCode == ConditionCode::NO_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("Small File Transfer") {}
|
SECTION("Small File Transfer") {}
|
||||||
|
@ -11,11 +11,12 @@ void UserMock::abandonedIndication(const TransactionId& id, cfdp::ConditionCode
|
|||||||
|
|
||||||
void UserMock::eofRecvIndication(const TransactionId& id) { eofsRevd.push(id); }
|
void UserMock::eofRecvIndication(const TransactionId& id) { eofsRevd.push(id); }
|
||||||
|
|
||||||
void UserMock::transactionFinishedIndication(const TransactionFinishedParams& finishedParams) {}
|
void UserMock::transactionFinishedIndication(const TransactionFinishedParams& finishedParams) {
|
||||||
|
finishedRecvd.push({finishedParams.id, finishedParams});
|
||||||
|
}
|
||||||
|
|
||||||
void UserMock::metadataRecvdIndication(const MetadataRecvdParams& params) {
|
void UserMock::metadataRecvdIndication(const MetadataRecvdParams& params) {
|
||||||
MetadataRecvdParams copy = params;
|
metadataRecvd.push({params.id, params});
|
||||||
metadataRecvd.push(copy);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UserMock::fileSegmentRecvdIndication(const FileSegmentRecvdParams& params) {}
|
void UserMock::fileSegmentRecvdIndication(const FileSegmentRecvdParams& params) {}
|
||||||
@ -27,7 +28,8 @@ void UserMock::faultIndication(const TransactionId& id, cfdp::ConditionCode code
|
|||||||
|
|
||||||
void UserMock::reset() {
|
void UserMock::reset() {
|
||||||
std::queue<TransactionId>().swap(eofsRevd);
|
std::queue<TransactionId>().swap(eofsRevd);
|
||||||
std::queue<cfdp::MetadataRecvdParams>().swap(metadataRecvd);
|
std::queue<std::pair<TransactionId, cfdp::MetadataRecvdParams>>().swap(metadataRecvd);
|
||||||
|
std::queue<std::pair<TransactionId, cfdp::TransactionFinishedParams>>().swap(finishedRecvd);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace cfdp
|
} // namespace cfdp
|
||||||
|
@ -23,8 +23,9 @@ class UserMock : public UserBase {
|
|||||||
void resumedIndication(const TransactionId& id, size_t progress) override;
|
void resumedIndication(const TransactionId& id, size_t progress) override;
|
||||||
void faultIndication(const TransactionId& id, ConditionCode code, size_t progress) override;
|
void faultIndication(const TransactionId& id, ConditionCode code, size_t progress) override;
|
||||||
|
|
||||||
std::queue<MetadataRecvdParams> metadataRecvd;
|
std::queue<std::pair<TransactionId, MetadataRecvdParams>> metadataRecvd;
|
||||||
std::queue<TransactionId> eofsRevd;
|
std::queue<TransactionId> eofsRevd;
|
||||||
|
std::queue<std::pair<TransactionId, TransactionFinishedParams>> finishedRecvd;
|
||||||
void reset();
|
void reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user