TMTC Stack Refactoring #106
@ -3,5 +3,4 @@ target_sources(${FSFW_TEST_TGT} PRIVATE
|
|||||||
testLocalPoolVector.cpp
|
testLocalPoolVector.cpp
|
||||||
testDataSet.cpp
|
testDataSet.cpp
|
||||||
testLocalPoolManager.cpp
|
testLocalPoolManager.cpp
|
||||||
LocalPoolOwnerBase.cpp
|
|
||||||
)
|
)
|
||||||
|
@ -9,11 +9,12 @@
|
|||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
|
||||||
#include "CatchDefinitions.h"
|
#include "CatchDefinitions.h"
|
||||||
#include "LocalPoolOwnerBase.h"
|
#include "mocks/LocalPoolOwnerBase.h"
|
||||||
|
#include "mocks/MessageQueueMock.h"
|
||||||
#include "tests/TestsConfig.h"
|
#include "tests/TestsConfig.h"
|
||||||
|
|
||||||
TEST_CASE("DataSetTest", "[DataSetTest]") {
|
TEST_CASE("DataSetTest", "[DataSetTest]") {
|
||||||
auto queue = MessageQueueMockBase();
|
auto queue = MessageQueueMock();
|
||||||
LocalPoolOwnerBase poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
LocalPoolOwnerBase poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||||
REQUIRE(poolOwner.initializeHkManager() == retval::CATCH_OK);
|
REQUIRE(poolOwner.initializeHkManager() == retval::CATCH_OK);
|
||||||
REQUIRE(poolOwner.initializeHkManagerAfterTaskCreation() == retval::CATCH_OK);
|
REQUIRE(poolOwner.initializeHkManagerAfterTaskCreation() == retval::CATCH_OK);
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "CatchDefinitions.h"
|
#include "CatchDefinitions.h"
|
||||||
#include "LocalPoolOwnerBase.h"
|
#include "mocks/LocalPoolOwnerBase.h"
|
||||||
#include "mocks/HkReceiverMock.h"
|
#include "mocks/HkReceiverMock.h"
|
||||||
|
|
||||||
TEST_CASE("Local Pool Manager Tests", "[LocManTest]") {
|
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 hkDest = defaultDestId;
|
||||||
const MessageQueueId_t subscriberId = 2;
|
const MessageQueueId_t subscriberId = 2;
|
||||||
auto hkReceiver = HkReceiverMock(hkDest);
|
auto hkReceiver = HkReceiverMock(hkDest);
|
||||||
auto queue = MessageQueueMockBase();
|
auto queue = MessageQueueMock();
|
||||||
LocalPoolOwnerBase poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
LocalPoolOwnerBase poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||||
REQUIRE(poolOwner.initializeHkManager() == retval::CATCH_OK);
|
REQUIRE(poolOwner.initializeHkManager() == retval::CATCH_OK);
|
||||||
REQUIRE(poolOwner.initializeHkManagerAfterTaskCreation() == 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
|
// TODO: This is ugly. This should be an arbitrary ctor argument. Fix this in the pool
|
||||||
// manager
|
// manager
|
||||||
|
@ -4,15 +4,14 @@
|
|||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
|
||||||
#include "CatchDefinitions.h"
|
#include "CatchDefinitions.h"
|
||||||
#include "LocalPoolOwnerBase.h"
|
#include "mocks/LocalPoolOwnerBase.h"
|
||||||
#include "tests/TestsConfig.h"
|
#include "tests/TestsConfig.h"
|
||||||
|
|
||||||
TEST_CASE("LocalPoolVariable", "[LocPoolVarTest]") {
|
TEST_CASE("LocalPoolVariable", "[LocPoolVarTest]") {
|
||||||
auto* poolOwner =
|
auto queue = MessageQueueMock();
|
||||||
ObjectManager::instance()->get<LocalPoolOwnerBase>(objects::TEST_LOCAL_POOL_OWNER_BASE);
|
LocalPoolOwnerBase poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||||
REQUIRE(poolOwner != nullptr);
|
REQUIRE(poolOwner.initializeHkManager() == retval::CATCH_OK);
|
||||||
REQUIRE(poolOwner->initializeHkManager() == retval::CATCH_OK);
|
REQUIRE(poolOwner.initializeHkManagerAfterTaskCreation() == retval::CATCH_OK);
|
||||||
REQUIRE(poolOwner->initializeHkManagerAfterTaskCreation() == retval::CATCH_OK);
|
|
||||||
|
|
||||||
SECTION("Basic Tests") {
|
SECTION("Basic Tests") {
|
||||||
/* very basic test. */
|
/* very basic test. */
|
||||||
@ -106,6 +105,4 @@ TEST_CASE("LocalPoolVariable", "[LocPoolVarTest]") {
|
|||||||
lp_var_t<uint8_t> invalidObjectVar2 = lp_var_t<uint8_t>(globPoolId);
|
lp_var_t<uint8_t> invalidObjectVar2 = lp_var_t<uint8_t>(globPoolId);
|
||||||
lp_var_t<uint8_t> invalidObjectVar3 = lp_var_t<uint8_t>(nullptr, lpool::uint8VarId);
|
lp_var_t<uint8_t> invalidObjectVar3 = lp_var_t<uint8_t>(nullptr, lpool::uint8VarId);
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK(poolOwner->reset() == retval::CATCH_OK);
|
|
||||||
}
|
}
|
||||||
|
@ -8,11 +8,10 @@
|
|||||||
#include "tests/TestsConfig.h"
|
#include "tests/TestsConfig.h"
|
||||||
|
|
||||||
TEST_CASE("LocalPoolVector", "[LocPoolVecTest]") {
|
TEST_CASE("LocalPoolVector", "[LocPoolVecTest]") {
|
||||||
auto* poolOwner =
|
auto queue = MessageQueueMock();
|
||||||
ObjectManager::instance()->get<LocalPoolOwnerBase>(objects::TEST_LOCAL_POOL_OWNER_BASE);
|
LocalPoolOwnerBase poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||||
REQUIRE(poolOwner != nullptr);
|
REQUIRE(poolOwner.initializeHkManager() == retval::CATCH_OK);
|
||||||
REQUIRE(poolOwner->initializeHkManager() == retval::CATCH_OK);
|
REQUIRE(poolOwner.initializeHkManagerAfterTaskCreation() == retval::CATCH_OK);
|
||||||
REQUIRE(poolOwner->initializeHkManagerAfterTaskCreation() == retval::CATCH_OK);
|
|
||||||
|
|
||||||
SECTION("BasicTest") {
|
SECTION("BasicTest") {
|
||||||
// very basic test.
|
// 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);
|
objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint16Vec3Id, nullptr, pool_rwm_t::VAR_READ);
|
||||||
REQUIRE(readOnlyVec.commit() == static_cast<int>(PoolVariableIF::INVALID_READ_WRITE_MODE));
|
REQUIRE(readOnlyVec.commit() == static_cast<int>(PoolVariableIF::INVALID_READ_WRITE_MODE));
|
||||||
}
|
}
|
||||||
poolOwner->reset();
|
|
||||||
}
|
}
|
||||||
|
@ -6,4 +6,5 @@ target_sources(${FSFW_TEST_TGT} PRIVATE
|
|||||||
ComIFMock.cpp
|
ComIFMock.cpp
|
||||||
MessageQueueMock.cpp
|
MessageQueueMock.cpp
|
||||||
InternalErrorReporterMock.cpp
|
InternalErrorReporterMock.cpp
|
||||||
|
LocalPoolOwnerBase.cpp
|
||||||
)
|
)
|
||||||
|
@ -98,8 +98,8 @@ class LocalPoolOwnerBase : public SystemObject, public HasLocalDataPoolIF {
|
|||||||
|
|
||||||
LocalPoolObjectBase* getPoolObjectHandle(lp_id_t localPoolId) override;
|
LocalPoolObjectBase* getPoolObjectHandle(lp_id_t localPoolId) override;
|
||||||
|
|
||||||
[[nodiscard]] MessageQueueMockBase& getMockQueueHandle() const {
|
[[nodiscard]] MessageQueueMock& getMockQueueHandle() const {
|
||||||
return dynamic_cast<MessageQueueMockBase&>(queue);
|
return dynamic_cast<MessageQueueMock&>(queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t subscribePeriodicHk(bool enableReporting) {
|
ReturnValue_t subscribePeriodicHk(bool enableReporting) {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "fsfw/tmtcservices/TmSendHelper.h"
|
#include "fsfw/tmtcservices/TmSendHelper.h"
|
||||||
#include "mocks/InternalErrorReporterMock.h"
|
#include "mocks/InternalErrorReporterMock.h"
|
||||||
@ -6,8 +7,9 @@
|
|||||||
|
|
||||||
TEST_CASE("TM Send Helper", "[tm-send-helper]") {
|
TEST_CASE("TM Send Helper", "[tm-send-helper]") {
|
||||||
auto errReporter = InternalErrorReporterMock();
|
auto errReporter = InternalErrorReporterMock();
|
||||||
auto msgQueue = MessageQueueMockBase();
|
auto msgQueue = MessageQueueMock();
|
||||||
TmSendHelper sendHelper(&msgQueue, &errReporter);
|
TmSendHelper sendHelper(&msgQueue, &errReporter);
|
||||||
|
|
||||||
SECTION("State") {}
|
SECTION("State") {
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user