basic storage manager mock
This commit is contained in:
parent
bddf5bded1
commit
22e1555f50
@ -2,31 +2,76 @@
|
||||
|
||||
ReturnValue_t StorageManagerMock::addData(store_address_t *storageId, const uint8_t *data,
|
||||
size_t size, bool ignoreFault) {
|
||||
return 0;
|
||||
if (nextAddDataCallFails.first) {
|
||||
return nextAddDataCallFails.second;
|
||||
}
|
||||
return LocalPool::addData(storageId, data, size, ignoreFault);
|
||||
}
|
||||
ReturnValue_t StorageManagerMock::deleteData(store_address_t packet_id) {
|
||||
if(nextDeleteDataCallFails.first) {
|
||||
return nextDeleteDataCallFails.second;
|
||||
}
|
||||
return LocalPool::deleteData(packet_id);
|
||||
}
|
||||
ReturnValue_t StorageManagerMock::deleteData(store_address_t packet_id) { return 0; }
|
||||
|
||||
ReturnValue_t StorageManagerMock::deleteData(uint8_t *buffer, size_t size,
|
||||
store_address_t *storeId) {
|
||||
return 0;
|
||||
if(nextDeleteDataCallFails.first) {
|
||||
return nextDeleteDataCallFails.second;
|
||||
}
|
||||
return LocalPool::deleteData(buffer, size, storeId);
|
||||
}
|
||||
|
||||
ReturnValue_t StorageManagerMock::getData(store_address_t packet_id, const uint8_t **packet_ptr,
|
||||
size_t *size) {
|
||||
return 0;
|
||||
if (nextGetDataCallFails.first) {
|
||||
return nextGetDataCallFails.second;
|
||||
}
|
||||
return LocalPool::getData(packet_id, packet_ptr, size);
|
||||
}
|
||||
|
||||
ReturnValue_t StorageManagerMock::modifyData(store_address_t packet_id, uint8_t **packet_ptr,
|
||||
size_t *size) {
|
||||
return 0;
|
||||
if (nextModifyDataCallFails.first) {
|
||||
return nextModifyDataCallFails.second;
|
||||
}
|
||||
return LocalPool::modifyData(packet_id, packet_ptr, size);
|
||||
}
|
||||
ReturnValue_t StorageManagerMock::getFreeElement(store_address_t *storageId, size_t size,
|
||||
uint8_t **p_data, bool ignoreFault) {
|
||||
return 0;
|
||||
}
|
||||
bool StorageManagerMock::hasDataAtId(store_address_t storeId) const { return false; }
|
||||
void StorageManagerMock::clearStore() {}
|
||||
void StorageManagerMock::clearSubPool(uint8_t poolIndex) {}
|
||||
void StorageManagerMock::getFillCount(uint8_t *buffer, uint8_t *bytesWritten) {}
|
||||
size_t StorageManagerMock::getTotalSize(size_t *additionalSize) { return 0; }
|
||||
StorageManagerIF::max_subpools_t StorageManagerMock::getNumberOfSubPools() const { return 0; }
|
||||
bool StorageManagerMock::hasDataAtId(store_address_t storeId) const {
|
||||
return LocalPool::hasDataAtId(storeId);
|
||||
}
|
||||
void StorageManagerMock::clearStore() {
|
||||
return LocalPool::clearStore();
|
||||
}
|
||||
|
||||
void StorageManagerMock::clearSubPool(uint8_t poolIndex) {
|
||||
return LocalPool::clearSubPool(poolIndex);
|
||||
}
|
||||
|
||||
void StorageManagerMock::getFillCount(uint8_t *buffer, uint8_t *bytesWritten) {
|
||||
return LocalPool::getFillCount(buffer, bytesWritten);
|
||||
}
|
||||
|
||||
size_t StorageManagerMock::getTotalSize(size_t *additionalSize) {
|
||||
return LocalPool::getTotalSize(additionalSize);
|
||||
}
|
||||
|
||||
StorageManagerIF::max_subpools_t StorageManagerMock::getNumberOfSubPools() const {
|
||||
return LocalPool::getNumberOfSubPools();
|
||||
}
|
||||
|
||||
void StorageManagerMock::reset() {
|
||||
clearStore();
|
||||
nextAddDataCallFails.first = false;
|
||||
nextAddDataCallFails.second = result::OK;
|
||||
nextModifyDataCallFails.first = false;
|
||||
nextModifyDataCallFails.second = result::OK;
|
||||
nextGetDataCallFails.first = false;
|
||||
nextGetDataCallFails.second = result::OK;
|
||||
nextDeleteDataCallFails.first = false;
|
||||
nextDeleteDataCallFails.second = result::OK;
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
#ifndef FSFW_TESTS_STORAGEMANAGERMOCK_H
|
||||
#define FSFW_TESTS_STORAGEMANAGERMOCK_H
|
||||
|
||||
#include "fsfw/storagemanager/LocalPool.h"
|
||||
#include "fsfw/storagemanager/StorageManagerIF.h"
|
||||
|
||||
class StorageManagerMock: public StorageManagerIF {
|
||||
class StorageManagerMock: public LocalPool {
|
||||
public:
|
||||
ReturnValue_t addData(store_address_t *storageId, const uint8_t *data, size_t size,
|
||||
bool ignoreFault) override;
|
||||
@ -20,5 +21,12 @@ class StorageManagerMock: public StorageManagerIF {
|
||||
void getFillCount(uint8_t *buffer, uint8_t *bytesWritten) override;
|
||||
size_t getTotalSize(size_t *additionalSize) override;
|
||||
[[nodiscard]] max_subpools_t getNumberOfSubPools() const override;
|
||||
|
||||
std::pair<bool, ReturnValue_t> nextAddDataCallFails;
|
||||
std::pair<bool, ReturnValue_t> nextModifyDataCallFails;
|
||||
std::pair<bool, ReturnValue_t> nextGetDataCallFails;
|
||||
std::pair<bool, ReturnValue_t> nextDeleteDataCallFails;
|
||||
|
||||
void reset();
|
||||
};
|
||||
#endif // FSFW_TESTS_STORAGEMANAGERMOCK_H
|
||||
|
Loading…
Reference in New Issue
Block a user