From b241ef6aad5861dc570548fd17bdf856e3332984 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 5 Jan 2021 22:51:49 +0100 Subject: [PATCH] continued tests --- unittest/tests/datapoollocal/LocalPoolOwnerBase.h | 2 ++ .../tests/datapoollocal/LocalPoolVariableTest.cpp | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/unittest/tests/datapoollocal/LocalPoolOwnerBase.h b/unittest/tests/datapoollocal/LocalPoolOwnerBase.h index b73c5299..40f657be 100644 --- a/unittest/tests/datapoollocal/LocalPoolOwnerBase.h +++ b/unittest/tests/datapoollocal/LocalPoolOwnerBase.h @@ -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 testUint8 = lp_var_t(this, lpool::uint8VarId); lp_var_t testFloat = lp_var_t(this, lpool::floatVarId); + lp_var_t testUint32 = lp_var_t(this, lpool::uint32VarId); MessageQueueIF* messageQueue = nullptr; LocalDataPoolManager hkManager; diff --git a/unittest/tests/datapoollocal/LocalPoolVariableTest.cpp b/unittest/tests/datapoollocal/LocalPoolVariableTest.cpp index f52ff925..faca03e3 100644 --- a/unittest/tests/datapoollocal/LocalPoolVariableTest.cpp +++ b/unittest/tests/datapoollocal/LocalPoolVariableTest.cpp @@ -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 invalidVariable = lp_var_t( @@ -36,12 +38,20 @@ TEST_CASE("LocalPoolVariable" , "[LocPoolVarTest]") { REQUIRE(invalidVariable2.read() == static_cast(HasLocalDataPoolIF::POOL_ENTRY_TYPE_CONFLICT)); - // now try to access with wrong type - lp_var_t readOnlyVar = lp_var_t( + lp_var_t readOnlyVar = lp_var_t( objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId, nullptr, pool_rwm_t::VAR_READ); REQUIRE(readOnlyVar.commit() == static_cast(PoolVariableIF::INVALID_READ_WRITE_MODE)); + lp_var_t writeOnlyVar = lp_var_t( + objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId, + nullptr, pool_rwm_t::VAR_WRITE); + REQUIRE(writeOnlyVar.read() == static_cast( + PoolVariableIF::INVALID_READ_WRITE_MODE)); + + lp_var_t uint32tVar = lp_var_t( + objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint32VarId); + sif::info << "LocalPoolVariable printout: " <