From edf1d5ae8da626727ac52574506dbc166d2496c0 Mon Sep 17 00:00:00 2001 From: Steffen Gaisser Date: Mon, 20 Jun 2022 16:02:35 +0200 Subject: [PATCH] Added more test cases --- .../unit/storagemanager/TestNewAccessor.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp b/tests/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp index 98654a44..9631de38 100644 --- a/tests/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp +++ b/tests/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp @@ -165,14 +165,22 @@ TEST_CASE("New Accessor", "[NewAccessor]") { StorageAccessor accessor2(0); accessor2 = std::move(accessor); REQUIRE(accessor.data() == nullptr); - std::array data; - size_t size = 10; - result = accessor.write(data.data(), size); + std::array data; + size_t size = 6; + result = accessor.write(data.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); + + std::array newData; + // Expect data to be invalid so this must return RETURN_FAILED + result = accessor.getDataCopy(newData.data(),newData.size()); + REQUIRE(result == HasReturnvaluesIF::RETURN_FAILED); + // Expect data to be too small + result = accessor2.getDataCopy(data.data(),data.size()); + REQUIRE(result == HasReturnvaluesIF::RETURN_FAILED); } } }