1
0
forked from fsfw/fsfw
This commit is contained in:
2023-01-26 13:40:44 +01:00
parent 941bf61f28
commit e37af4fe70
32 changed files with 94 additions and 104 deletions

View File

@ -5,9 +5,9 @@
#include "fsfw/serialize/SerializeIF.h"
ReturnValue_t FilesystemMock::feedFile(const std::string &filename, std::ifstream &file) {
//not multibyte encoding safe!
std::basic_string<std::filesystem::path::value_type> native_filename(filename.begin(), filename.end());
// not multibyte encoding safe!
std::basic_string<std::filesystem::path::value_type> native_filename(filename.begin(),
filename.end());
if (not std::filesystem::exists(native_filename)) {
return returnvalue::FAILED;

View File

@ -20,8 +20,9 @@
class FilesystemMock : public HasFileSystemIF {
public:
struct FileWriteInfo {
FileWriteInfo(std::basic_string<std::filesystem::path::value_type> filename, size_t offset, const uint8_t *data, size_t len)
: offset(offset) {
FileWriteInfo(std::basic_string<std::filesystem::path::value_type> filename, size_t offset,
const uint8_t *data, size_t len)
: offset(offset) {
this->filename = filename;
this->data.insert(this->data.end(), data, data + len);
}
@ -47,8 +48,8 @@ class FilesystemMock : public HasFileSystemIF {
std::map<std::basic_string<std::filesystem::path::value_type>, DirInfo> dirMap;
struct RenameInfo {
RenameInfo(std::basic_string < std::filesystem::path::value_type> oldName,
std::basic_string < std::filesystem::path::value_type> newName)
RenameInfo(std::basic_string<std::filesystem::path::value_type> oldName,
std::basic_string<std::filesystem::path::value_type> newName)
: oldName(std::move(oldName)), newName(std::move(newName)) {}
std::basic_string<std::filesystem::path::value_type> oldName;
@ -56,8 +57,7 @@ class FilesystemMock : public HasFileSystemIF {
};
std::queue<RenameInfo> renameQueue;
std::basic_string<std::filesystem::path::value_type> truncateCalledOnFile;
ReturnValue_t feedFile(const std::string &filename,
std::ifstream &file);
ReturnValue_t feedFile(const std::string &filename, std::ifstream &file);
bool fileExists(FilesystemParams params) override;
ReturnValue_t truncateFile(FilesystemParams params) override;