diff --git a/unittests/datapoollocal/CMakeLists.txt b/unittests/datapoollocal/CMakeLists.txt index 6b8946a26..016645fd0 100644 --- a/unittests/datapoollocal/CMakeLists.txt +++ b/unittests/datapoollocal/CMakeLists.txt @@ -3,5 +3,4 @@ target_sources(${FSFW_TEST_TGT} PRIVATE testLocalPoolVector.cpp testDataSet.cpp testLocalPoolManager.cpp - LocalPoolOwnerBase.cpp ) diff --git a/unittests/datapoollocal/testDataSet.cpp b/unittests/datapoollocal/testDataSet.cpp index 62bf59bbd..0ef5a77f8 100644 --- a/unittests/datapoollocal/testDataSet.cpp +++ b/unittests/datapoollocal/testDataSet.cpp @@ -9,11 +9,12 @@ #include #include "CatchDefinitions.h" -#include "LocalPoolOwnerBase.h" +#include "mocks/LocalPoolOwnerBase.h" +#include "mocks/MessageQueueMock.h" #include "tests/TestsConfig.h" TEST_CASE("DataSetTest", "[DataSetTest]") { - auto queue = MessageQueueMockBase(); + auto queue = MessageQueueMock(); LocalPoolOwnerBase poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE); REQUIRE(poolOwner.initializeHkManager() == retval::CATCH_OK); REQUIRE(poolOwner.initializeHkManagerAfterTaskCreation() == retval::CATCH_OK); diff --git a/unittests/datapoollocal/testLocalPoolManager.cpp b/unittests/datapoollocal/testLocalPoolManager.cpp index 9c979df2e..228ab08c2 100644 --- a/unittests/datapoollocal/testLocalPoolManager.cpp +++ b/unittests/datapoollocal/testLocalPoolManager.cpp @@ -12,7 +12,7 @@ #include #include "CatchDefinitions.h" -#include "LocalPoolOwnerBase.h" +#include "mocks/LocalPoolOwnerBase.h" #include "mocks/HkReceiverMock.h" TEST_CASE("Local Pool Manager Tests", "[LocManTest]") { @@ -20,12 +20,12 @@ TEST_CASE("Local Pool Manager Tests", "[LocManTest]") { const MessageQueueId_t hkDest = defaultDestId; const MessageQueueId_t subscriberId = 2; auto hkReceiver = HkReceiverMock(hkDest); - auto queue = MessageQueueMockBase(); + auto queue = MessageQueueMock(); LocalPoolOwnerBase poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE); REQUIRE(poolOwner.initializeHkManager() == retval::CATCH_OK); REQUIRE(poolOwner.initializeHkManagerAfterTaskCreation() == retval::CATCH_OK); - MessageQueueMockBase& poolOwnerMock = poolOwner.getMockQueueHandle(); + MessageQueueMock& poolOwnerMock = poolOwner.getMockQueueHandle(); // TODO: This is ugly. This should be an arbitrary ctor argument. Fix this in the pool // manager diff --git a/unittests/datapoollocal/testLocalPoolVariable.cpp b/unittests/datapoollocal/testLocalPoolVariable.cpp index 3479cdbeb..dda5aca64 100644 --- a/unittests/datapoollocal/testLocalPoolVariable.cpp +++ b/unittests/datapoollocal/testLocalPoolVariable.cpp @@ -4,15 +4,14 @@ #include #include "CatchDefinitions.h" -#include "LocalPoolOwnerBase.h" +#include "mocks/LocalPoolOwnerBase.h" #include "tests/TestsConfig.h" TEST_CASE("LocalPoolVariable", "[LocPoolVarTest]") { - auto* poolOwner = - ObjectManager::instance()->get(objects::TEST_LOCAL_POOL_OWNER_BASE); - REQUIRE(poolOwner != nullptr); - REQUIRE(poolOwner->initializeHkManager() == retval::CATCH_OK); - REQUIRE(poolOwner->initializeHkManagerAfterTaskCreation() == retval::CATCH_OK); + auto queue = MessageQueueMock(); + LocalPoolOwnerBase poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE); + REQUIRE(poolOwner.initializeHkManager() == retval::CATCH_OK); + REQUIRE(poolOwner.initializeHkManagerAfterTaskCreation() == retval::CATCH_OK); SECTION("Basic Tests") { /* very basic test. */ @@ -106,6 +105,4 @@ TEST_CASE("LocalPoolVariable", "[LocPoolVarTest]") { lp_var_t invalidObjectVar2 = lp_var_t(globPoolId); lp_var_t invalidObjectVar3 = lp_var_t(nullptr, lpool::uint8VarId); } - - CHECK(poolOwner->reset() == retval::CATCH_OK); } diff --git a/unittests/datapoollocal/testLocalPoolVector.cpp b/unittests/datapoollocal/testLocalPoolVector.cpp index 331d4e094..dc91fa7e7 100644 --- a/unittests/datapoollocal/testLocalPoolVector.cpp +++ b/unittests/datapoollocal/testLocalPoolVector.cpp @@ -8,11 +8,10 @@ #include "tests/TestsConfig.h" TEST_CASE("LocalPoolVector", "[LocPoolVecTest]") { - auto* poolOwner = - ObjectManager::instance()->get(objects::TEST_LOCAL_POOL_OWNER_BASE); - REQUIRE(poolOwner != nullptr); - REQUIRE(poolOwner->initializeHkManager() == retval::CATCH_OK); - REQUIRE(poolOwner->initializeHkManagerAfterTaskCreation() == retval::CATCH_OK); + auto queue = MessageQueueMock(); + LocalPoolOwnerBase poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE); + REQUIRE(poolOwner.initializeHkManager() == retval::CATCH_OK); + REQUIRE(poolOwner.initializeHkManagerAfterTaskCreation() == retval::CATCH_OK); SECTION("BasicTest") { // very basic test. @@ -106,5 +105,4 @@ TEST_CASE("LocalPoolVector", "[LocPoolVecTest]") { objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint16Vec3Id, nullptr, pool_rwm_t::VAR_READ); REQUIRE(readOnlyVec.commit() == static_cast(PoolVariableIF::INVALID_READ_WRITE_MODE)); } - poolOwner->reset(); } diff --git a/unittests/mocks/CMakeLists.txt b/unittests/mocks/CMakeLists.txt index 9ecb013a4..7bc8fd30d 100644 --- a/unittests/mocks/CMakeLists.txt +++ b/unittests/mocks/CMakeLists.txt @@ -6,4 +6,5 @@ target_sources(${FSFW_TEST_TGT} PRIVATE ComIFMock.cpp MessageQueueMock.cpp InternalErrorReporterMock.cpp + LocalPoolOwnerBase.cpp ) diff --git a/unittests/mocks/LocalPoolOwnerBase.h b/unittests/mocks/LocalPoolOwnerBase.h index 132885ac3..329aa0b37 100644 --- a/unittests/mocks/LocalPoolOwnerBase.h +++ b/unittests/mocks/LocalPoolOwnerBase.h @@ -98,8 +98,8 @@ class LocalPoolOwnerBase : public SystemObject, public HasLocalDataPoolIF { LocalPoolObjectBase* getPoolObjectHandle(lp_id_t localPoolId) override; - [[nodiscard]] MessageQueueMockBase& getMockQueueHandle() const { - return dynamic_cast(queue); + [[nodiscard]] MessageQueueMock& getMockQueueHandle() const { + return dynamic_cast(queue); } ReturnValue_t subscribePeriodicHk(bool enableReporting) { diff --git a/unittests/tmtcservices/testSendHelper.cpp b/unittests/tmtcservices/testSendHelper.cpp index 09d34a504..fc5b86bd1 100644 --- a/unittests/tmtcservices/testSendHelper.cpp +++ b/unittests/tmtcservices/testSendHelper.cpp @@ -1,4 +1,5 @@ #include +#include #include "fsfw/tmtcservices/TmSendHelper.h" #include "mocks/InternalErrorReporterMock.h" @@ -6,8 +7,9 @@ TEST_CASE("TM Send Helper", "[tm-send-helper]") { auto errReporter = InternalErrorReporterMock(); - auto msgQueue = MessageQueueMockBase(); + auto msgQueue = MessageQueueMock(); TmSendHelper sendHelper(&msgQueue, &errReporter); - SECTION("State") {} + SECTION("State") { + } } \ No newline at end of file