Added more test cases

This commit is contained in:
Steffen Gaisser 2022-06-20 16:02:35 +02:00
parent b60e4bcb90
commit edf1d5ae8d

View File

@ -165,14 +165,22 @@ TEST_CASE("New Accessor", "[NewAccessor]") {
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);
std::array<uint8_t, 6> 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<uint8_t, 10> 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);
}
}
}