1
0
forked from fsfw/fsfw

add FS mock and improve HasFilesystemIF

This commit is contained in:
2022-08-10 11:09:07 +02:00
parent 3e1fd15613
commit 28c8248f26
6 changed files with 106 additions and 32 deletions

View File

@ -14,6 +14,7 @@ target_sources(
PusDistributorMock.cpp
CcsdsCheckerMock.cpp
AcceptsTcMock.cpp
StorageManagerMock.cpp)
StorageManagerMock.cpp
FilesystemMock.cpp)
add_subdirectory(cfdp)

View File

@ -0,0 +1,22 @@
#include "FilesystemMock.h"
ReturnValue_t FilesystemMock::writeToFile(FileOpParams params, const uint8_t *data) { return 0; }
ReturnValue_t FilesystemMock::readFromFile(FileOpParams fileOpInfo, uint8_t **buffer,
size_t &readSize, size_t maxSize) {
return 0;
}
ReturnValue_t FilesystemMock::createFile(FilesystemParams params, const uint8_t *data,
size_t size) {
return 0;
}
ReturnValue_t FilesystemMock::removeFile(const char *path, FileSystemArgsIF *args) { return 0; }
ReturnValue_t FilesystemMock::createDirectory(FilesystemParams params, bool createParentDirs) {
return 0;
}
ReturnValue_t FilesystemMock::removeDirectory(FilesystemParams params, bool deleteRecurively) {
return 0;
}
ReturnValue_t FilesystemMock::renameFile(const char *oldPath, char *newPath,
FileSystemArgsIF *args) {
return 0;
}

View File

@ -0,0 +1,19 @@
#ifndef FSFW_MOCKS_FILESYSTEMMOCK_H
#define FSFW_MOCKS_FILESYSTEMMOCK_H
#include "fsfw/filesystem.h"
class FilesystemMock : public HasFileSystemIF {
public:
MessageQueueId_t getCommandQueue() const override;
ReturnValue_t writeToFile(FileOpParams params, const uint8_t *data) override;
ReturnValue_t readFromFile(FileOpParams fileOpInfo, uint8_t **buffer, size_t &readSize,
size_t maxSize) override;
ReturnValue_t createFile(FilesystemParams params, const uint8_t *data, size_t size) override;
ReturnValue_t removeFile(const char *path, FileSystemArgsIF *args) override;
ReturnValue_t createDirectory(FilesystemParams params, bool createParentDirs) override;
ReturnValue_t removeDirectory(FilesystemParams params, bool deleteRecurively) override;
ReturnValue_t renameFile(const char *oldPath, char *newPath, FileSystemArgsIF *args) override;
};
#endif // FSFW_MOCKS_FILESYSTEMMOCK_H