Fix StorageAccessor move assignment
All checks were successful
fsfw/fsfw/pipeline/pr-development This commit looks good
All checks were successful
fsfw/fsfw/pipeline/pr-development This commit looks good
* Added Unittest for this * Fixed missing include in test
This commit is contained in:
parent
b18410aa63
commit
b60e4bcb90
@ -13,7 +13,7 @@ StorageAccessor::StorageAccessor(store_address_t storeId, StorageManagerIF* stor
|
||||
StorageAccessor& StorageAccessor::operator=(StorageAccessor&& other) {
|
||||
// Call the parent move assignment and also assign own member.
|
||||
dataPointer = other.dataPointer;
|
||||
StorageAccessor::operator=(std::move(other));
|
||||
ConstStorageAccessor::operator=(std::move(other));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -156,4 +156,23 @@ TEST_CASE("New Accessor", "[NewAccessor]") {
|
||||
CHECK(receptionArray[i] == 42);
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("Operators"){
|
||||
result = SimplePool.addData(&testStoreId, testDataArray.data(), size);
|
||||
REQUIRE(result == retval::CATCH_OK);
|
||||
{
|
||||
StorageAccessor accessor(testStoreId);
|
||||
StorageAccessor accessor2(0);
|
||||
accessor2 = std::move(accessor);
|
||||
REQUIRE(accessor.data() == nullptr);
|
||||
std::array<uint8_t, 10> data;
|
||||
size_t size = 10;
|
||||
result = accessor.write(data.data(), size);
|
||||
REQUIRE(result == HasReturnvaluesIF::RETURN_FAILED);
|
||||
result = SimplePool.modifyData(testStoreId, accessor2);
|
||||
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
||||
CHECK(accessor2.getId() == testStoreId);
|
||||
CHECK(accessor2.size() == 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <cstring>
|
||||
#include <array>
|
||||
|
||||
#include "fsfw_tests/unit/CatchDefinitions.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user