continued tests

This commit is contained in:
Robin Müller 2021-01-05 22:51:49 +01:00
parent a05cf8d4ab
commit b241ef6aad
2 changed files with 14 additions and 2 deletions

View File

@ -10,6 +10,7 @@
namespace lpool {
static constexpr lp_id_t uint8VarId = 0;
static constexpr lp_id_t floatVarId = 1;
static constexpr lp_id_t uint32VarId = 2;
}
@ -74,6 +75,7 @@ private:
lp_var_t<uint8_t> testUint8 = lp_var_t<uint8_t>(this, lpool::uint8VarId);
lp_var_t<float> testFloat = lp_var_t<float>(this, lpool::floatVarId);
lp_var_t<uint32_t> testUint32 = lp_var_t<uint32_t>(this, lpool::uint32VarId);
MessageQueueIF* messageQueue = nullptr;
LocalDataPoolManager hkManager;

View File

@ -23,6 +23,8 @@ TEST_CASE("LocalPoolVariable" , "[LocPoolVarTest]") {
REQUIRE(testVariable.value == 5);
CHECK(not testVariable.isValid());
testVariable.setValid(true);
CHECK(testVariable.isValid());
// not try to use a local pool variable which does not exist
lp_var_t<uint8_t> invalidVariable = lp_var_t<uint8_t>(
@ -36,12 +38,20 @@ TEST_CASE("LocalPoolVariable" , "[LocPoolVarTest]") {
REQUIRE(invalidVariable2.read() ==
static_cast<int>(HasLocalDataPoolIF::POOL_ENTRY_TYPE_CONFLICT));
// now try to access with wrong type
lp_var_t<int8_t> readOnlyVar = lp_var_t<int8_t>(
lp_var_t<uint8_t> readOnlyVar = lp_var_t<uint8_t>(
objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId,
nullptr, pool_rwm_t::VAR_READ);
REQUIRE(readOnlyVar.commit() ==
static_cast<int>(PoolVariableIF::INVALID_READ_WRITE_MODE));
lp_var_t<uint8_t> writeOnlyVar = lp_var_t<uint8_t>(
objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId,
nullptr, pool_rwm_t::VAR_WRITE);
REQUIRE(writeOnlyVar.read() == static_cast<int>(
PoolVariableIF::INVALID_READ_WRITE_MODE));
lp_var_t<uint32_t> uint32tVar = lp_var_t<uint32_t>(
objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint32VarId);
sif::info << "LocalPoolVariable printout: " <<uint32tVar << std::endl;
}
}