additional filesystem abstractions
This commit is contained in:
@ -56,7 +56,7 @@ TEST_CASE("CFDP Dest Handler", "[cfdp]") {
|
||||
}
|
||||
|
||||
SECTION("Empty File Transfer") {
|
||||
const DestFsmResult& res = destHandler.performStateMachine();
|
||||
const DestHandler::FsmResult& res = destHandler.performStateMachine();
|
||||
CHECK(res.result == OK);
|
||||
FileSize size(0);
|
||||
std::string srcNameString = "hello.txt";
|
||||
@ -76,6 +76,8 @@ TEST_CASE("CFDP Dest Handler", "[cfdp]") {
|
||||
packetInfoList.push_back(packetInfo);
|
||||
destHandler.performStateMachine();
|
||||
CHECK(res.result == OK);
|
||||
CHECK(res.callStatus == CallStatus::CALL_AGAIN);
|
||||
destHandler.performStateMachine();
|
||||
}
|
||||
|
||||
SECTION("Small File Transfer") {}
|
||||
|
@ -124,3 +124,17 @@ void FilesystemMock::reset() {
|
||||
std::queue<RenameInfo> empty;
|
||||
std::swap(renameQueue, empty);
|
||||
}
|
||||
|
||||
bool FilesystemMock::fileExists(FilesystemParams params) {
|
||||
std::string filename(params.path);
|
||||
auto iter = fileMap.find(filename);
|
||||
if (iter == fileMap.end()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
ReturnValue_t FilesystemMock::truncateFile(FilesystemParams params) {
|
||||
truncateCalledOnFile = params.path;
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
@ -53,8 +53,12 @@ class FilesystemMock : public HasFileSystemIF {
|
||||
std::string newName;
|
||||
};
|
||||
std::queue<RenameInfo> renameQueue;
|
||||
|
||||
std::string truncateCalledOnFile;
|
||||
ReturnValue_t feedFile(const std::string &filename, std::ifstream &file);
|
||||
|
||||
bool fileExists(FilesystemParams params) override;
|
||||
ReturnValue_t truncateFile(FilesystemParams params) override;
|
||||
|
||||
ReturnValue_t writeToFile(FileOpParams params, const uint8_t *data) override;
|
||||
ReturnValue_t readFromFile(FileOpParams params, uint8_t **buffer, size_t &readSize,
|
||||
size_t maxSize) override;
|
||||
|
Reference in New Issue
Block a user