continue update
This commit is contained in:
@ -4,8 +4,7 @@ target_sources(${FSFW_TEST_TGT} PRIVATE CatchDefinitions.cpp CatchFactory.cpp
|
||||
target_sources(${FSFW_TEST_TGT} PRIVATE CatchRunner.cpp CatchSetup.cpp)
|
||||
|
||||
add_subdirectory(testcfg)
|
||||
add_subdirectory(mocks)
|
||||
|
||||
add_subdirectory(mock)
|
||||
add_subdirectory(tcdistributor)
|
||||
add_subdirectory(action)
|
||||
add_subdirectory(power)
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <fsfw/tmtcservices/CommandingServiceBase.h>
|
||||
#include <fsfw/tmtcservices/PusServiceBase.h>
|
||||
|
||||
#include "mocks/HkReceiverMock.h"
|
||||
#include "mock/HkReceiverMock.h"
|
||||
#include "tests/TestsConfig.h"
|
||||
|
||||
#if FSFW_ADD_DEFAULT_FACTORY_FUNCTIONS == 1
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <array>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
#include "mock/MessageQueueMock.h"
|
||||
|
||||
TEST_CASE("Action Helper", "[action]") {
|
||||
ActionHelperOwnerMockBase testDhMock;
|
||||
|
@ -10,14 +10,14 @@
|
||||
#include "fsfw/cfdp/pdu/EofPduCreator.h"
|
||||
#include "fsfw/cfdp/pdu/FileDataCreator.h"
|
||||
#include "fsfw/cfdp/pdu/MetadataPduCreator.h"
|
||||
#include "mocks/AcceptsTmMock.h"
|
||||
#include "mocks/EventReportingProxyMock.h"
|
||||
#include "mocks/FilesystemMock.h"
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
#include "mocks/StorageManagerMock.h"
|
||||
#include "mocks/cfdp/FaultHandlerMock.h"
|
||||
#include "mocks/cfdp/RemoteConfigTableMock.h"
|
||||
#include "mocks/cfdp/UserMock.h"
|
||||
#include "mock/AcceptsTmMock.h"
|
||||
#include "mock/EventReportingProxyMock.h"
|
||||
#include "mock/FilesystemMock.h"
|
||||
#include "mock/MessageQueueMock.h"
|
||||
#include "mock/StorageManagerMock.h"
|
||||
#include "mock/cfdp/FaultHandlerMock.h"
|
||||
#include "mock/cfdp/RemoteConfigTableMock.h"
|
||||
#include "mock/cfdp/UserMock.h"
|
||||
|
||||
TEST_CASE("CFDP Dest Handler", "[cfdp]") {
|
||||
using namespace cfdp;
|
||||
|
@ -5,9 +5,9 @@
|
||||
#include "fsfw/cfdp/tlv/StringLv.h"
|
||||
#include "fsfw/storagemanager/LocalPool.h"
|
||||
#include "fsfw/tcdistribution/definitions.h"
|
||||
#include "mocks/AcceptsTcMock.h"
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
#include "mocks/StorageManagerMock.h"
|
||||
#include "mock/AcceptsTcMock.h"
|
||||
#include "mock/MessageQueueMock.h"
|
||||
#include "mock/StorageManagerMock.h"
|
||||
|
||||
TEST_CASE("CFDP Distributor", "[cfdp][distributor]") {
|
||||
LocalPool::LocalPoolConfig cfg = {{5, 32}, {2, 64}};
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "mocks/cfdp/FaultHandlerMock.h"
|
||||
#include "mock/cfdp/FaultHandlerMock.h"
|
||||
|
||||
TEST_CASE("CFDP Fault Handler", "[cfdp]") {
|
||||
using namespace cfdp;
|
||||
|
@ -10,8 +10,8 @@
|
||||
#include "fsfw/cfdp/tlv/StringLv.h"
|
||||
#include "fsfw/globalfunctions/arrayprinter.h"
|
||||
#include "fsfw/serialize.h"
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
#include "mocks/StorageManagerMock.h"
|
||||
#include "mock/MessageQueueMock.h"
|
||||
#include "mock/StorageManagerMock.h"
|
||||
|
||||
TEST_CASE("Reserved Message Parser", "[cfdp]") {
|
||||
using namespace cfdp;
|
||||
|
@ -15,14 +15,14 @@
|
||||
#include "fsfw/cfdp/pdu/MetadataPduReader.h"
|
||||
#include "fsfw/tmtcservices/TmTcMessage.h"
|
||||
#include "fsfw/util/SeqCountProvider.h"
|
||||
#include "mocks/AcceptsTmMock.h"
|
||||
#include "mocks/EventReportingProxyMock.h"
|
||||
#include "mocks/FilesystemMock.h"
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
#include "mocks/StorageManagerMock.h"
|
||||
#include "mocks/cfdp/FaultHandlerMock.h"
|
||||
#include "mocks/cfdp/RemoteConfigTableMock.h"
|
||||
#include "mocks/cfdp/UserMock.h"
|
||||
#include "mock/AcceptsTmMock.h"
|
||||
#include "mock/EventReportingProxyMock.h"
|
||||
#include "mock/FilesystemMock.h"
|
||||
#include "mock/MessageQueueMock.h"
|
||||
#include "mock/StorageManagerMock.h"
|
||||
#include "mock/cfdp/FaultHandlerMock.h"
|
||||
#include "mock/cfdp/RemoteConfigTableMock.h"
|
||||
#include "mock/cfdp/UserMock.h"
|
||||
|
||||
TEST_CASE("CFDP Source Handler", "[cfdp]") {
|
||||
using namespace cfdp;
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
#include <fsfw/datapoollocal/SharedLocalDataset.h>
|
||||
#include <fsfw/datapool/SharedSet.h>
|
||||
#include <fsfw/globalfunctions/bitutility.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
|
||||
@ -7,29 +7,30 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "CatchDefinitions.h"
|
||||
#include "mocks/LocalPoolOwnerBase.h"
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
#include "mock/MessageQueueMock.h"
|
||||
#include "mock/TestPoolOwner.h"
|
||||
#include "tests/TestsConfig.h"
|
||||
|
||||
using namespace returnvalue;
|
||||
using namespace lpool;
|
||||
|
||||
TEST_CASE("DataSetTest", "[DataSetTest]") {
|
||||
auto queue = MessageQueueMock(1);
|
||||
LocalPoolOwnerBase poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||
TestPoolOwner poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||
poolOwner.initialize();
|
||||
LocalPoolStaticTestDataSet localSet;
|
||||
StaticTestDataSet localSet;
|
||||
|
||||
SECTION("BasicTest") {
|
||||
/* Test some basic functions */
|
||||
CHECK(localSet.getReportingEnabled() == false);
|
||||
CHECK(localSet.getLocalPoolIdsSerializedSize(false) == 3 * sizeof(lp_id_t));
|
||||
CHECK(localSet.getLocalPoolIdsSerializedSize(true) == 3 * sizeof(lp_id_t) + sizeof(uint8_t));
|
||||
CHECK(localSet.getLocalPoolIdsSerializedSize(false) == 3 * sizeof(dp::id_t));
|
||||
CHECK(localSet.getLocalPoolIdsSerializedSize(true) == 3 * sizeof(dp::id_t) + sizeof(uint8_t));
|
||||
CHECK(localSet.getSid() == lpool::testSid0);
|
||||
CHECK(localSet.getCreatorObjectId() == objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||
size_t maxSize = localSet.getLocalPoolIdsSerializedSize(true);
|
||||
uint8_t localPoolIdBuff[maxSize];
|
||||
// Skip size field
|
||||
auto* lpIds = reinterpret_cast<lp_id_t*>(localPoolIdBuff + 1);
|
||||
auto* lpIds = reinterpret_cast<id_t*>(localPoolIdBuff + 1);
|
||||
size_t serSize = 0;
|
||||
auto* localPoolIdBuffPtr = reinterpret_cast<uint8_t*>(localPoolIdBuff);
|
||||
|
||||
@ -42,7 +43,7 @@ TEST_CASE("DataSetTest", "[DataSetTest]") {
|
||||
CHECK(lpIds[1] == localSet.localPoolVarFloat.getDataPoolId());
|
||||
CHECK(lpIds[2] == localSet.localPoolUint16Vec.getDataPoolId());
|
||||
// Now serialize without fill count
|
||||
lpIds = reinterpret_cast<lp_id_t*>(localPoolIdBuff);
|
||||
lpIds = reinterpret_cast<dp::id_t*>(localPoolIdBuff);
|
||||
localPoolIdBuffPtr = localPoolIdBuff;
|
||||
serSize = 0;
|
||||
CHECK(localSet.serializeLocalPoolIds(&localPoolIdBuffPtr, &serSize, maxSize,
|
||||
@ -125,26 +126,15 @@ TEST_CASE("DataSetTest", "[DataSetTest]") {
|
||||
CHECK(localSet.localPoolUint16Vec.value[1] == 0);
|
||||
CHECK(localSet.localPoolUint16Vec.value[2] == 0);
|
||||
}
|
||||
|
||||
/* Common fault test cases */
|
||||
LocalPoolObjectBase* variableHandle = poolOwner.getPoolObjectHandle(lpool::uint32VarId);
|
||||
CHECK(variableHandle != nullptr);
|
||||
CHECK(localSet.registerVariable(variableHandle) == static_cast<int>(DataSetIF::DATA_SET_FULL));
|
||||
variableHandle = nullptr;
|
||||
REQUIRE(localSet.registerVariable(variableHandle) ==
|
||||
static_cast<int>(DataSetIF::POOL_VAR_NULL));
|
||||
}
|
||||
|
||||
SECTION("SharedDataSet") {
|
||||
object_id_t sharedSetId = objects::SHARED_SET_ID;
|
||||
SharedLocalDataset sharedSet(sharedSetId, poolOwner.sharedPool, lpool::testSetId0, 5);
|
||||
SharedSet sharedSet(poolOwner.sharedPool, sharedSetId, 5);
|
||||
localSet.localPoolVarUint8.setReadWriteMode(pool_rwm_t::VAR_WRITE);
|
||||
localSet.localPoolUint16Vec.setReadWriteMode(pool_rwm_t::VAR_WRITE);
|
||||
CHECK(sharedSet.registerVariable(&localSet.localPoolVarUint8) == returnvalue::OK);
|
||||
CHECK(sharedSet.registerVariable(&localSet.localPoolUint16Vec) == returnvalue::OK);
|
||||
CHECK(sharedSet.initialize() == returnvalue::OK);
|
||||
CHECK(sharedSet.lockDataset() == returnvalue::OK);
|
||||
CHECK(sharedSet.unlockDataset() == returnvalue::OK);
|
||||
|
||||
{
|
||||
PoolReadGuard rg(&sharedSet);
|
||||
|
@ -1,6 +1,4 @@
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
#include <fsfw/datapoollocal/PeriodicHkGenerationHelper.h>
|
||||
#include <fsfw/datapoollocal/StaticSharedDataset.h>
|
||||
#include <fsfw/globalfunctions/timevalOperations.h>
|
||||
#include <fsfw/ipc/CommandMessageCleaner.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
@ -12,8 +10,10 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "CatchDefinitions.h"
|
||||
#include "mocks/HkReceiverMock.h"
|
||||
#include "mocks/LocalPoolOwnerBase.h"
|
||||
#include "mock/HkReceiverMock.h"
|
||||
#include "mock/TestPoolOwner.h"
|
||||
|
||||
using namespace lpool;
|
||||
|
||||
TEST_CASE("Local Pool Manager Tests", "[LocManTest]") {
|
||||
const MessageQueueId_t defaultDestId = 1;
|
||||
@ -21,7 +21,7 @@ TEST_CASE("Local Pool Manager Tests", "[LocManTest]") {
|
||||
const MessageQueueId_t subscriberId = 2;
|
||||
auto hkReceiver = HkReceiverMock(hkDest);
|
||||
auto queue = MessageQueueMock(3);
|
||||
LocalPoolOwnerBase poolOwner(queue, hkDest, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||
TestPoolOwner poolOwner(queue, hkDest, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||
|
||||
REQUIRE(poolOwner.initialize() == returnvalue::OK);
|
||||
|
||||
@ -32,7 +32,7 @@ TEST_CASE("Local Pool Manager Tests", "[LocManTest]") {
|
||||
SECTION("Basic Test") {
|
||||
{
|
||||
// For code coverage, should not crash
|
||||
PeriodicHkGenerationHelper manager(nullptr, nullptr);
|
||||
hk::PeriodicHelper manager(nullptr, nullptr);
|
||||
}
|
||||
auto owner = poolOwner.hkHelper.getOwner();
|
||||
REQUIRE(owner != nullptr);
|
||||
|
@ -1,23 +1,24 @@
|
||||
#include <fsfw/datapoollocal/PeriodicHkGenerationHelper.h>
|
||||
#include <fsfw/housekeeping/PeriodicHkHelper.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "CatchDefinitions.h"
|
||||
#include "mocks/LocalPoolOwnerBase.h"
|
||||
#include "mock/TestPoolOwner.h"
|
||||
#include "tests/TestsConfig.h"
|
||||
|
||||
using namespace returnvalue;
|
||||
using namespace lpool;
|
||||
using namespace dp;
|
||||
|
||||
TEST_CASE("LocalPoolVariable", "[LocPoolVarTest]") {
|
||||
auto queue = MessageQueueMock(1);
|
||||
LocalPoolOwnerBase poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||
lpool::TestPoolOwner poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||
REQUIRE(poolOwner.initialize() == OK);
|
||||
|
||||
SECTION("Basic Tests") {
|
||||
/* very basic test. */
|
||||
lp_var_t<uint8_t> testVariable =
|
||||
lp_var_t<uint8_t>(objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId);
|
||||
u8_t testVariable{objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId};
|
||||
REQUIRE(testVariable.read() == returnvalue::OK);
|
||||
CHECK(testVariable.value == 0);
|
||||
testVariable.value = 5;
|
||||
@ -34,8 +35,8 @@ TEST_CASE("LocalPoolVariable", "[LocPoolVarTest]") {
|
||||
CHECK(testVariable.getDataPoolId() == 22);
|
||||
testVariable.setDataPoolId(lpool::uint8VarId);
|
||||
|
||||
gp_id_t globPoolId(objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId);
|
||||
lp_var_t<uint8_t> testVariable2 = lp_var_t<uint8_t>(globPoolId);
|
||||
g_id_t globPoolId(objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId);
|
||||
u8_t testVariable2{globPoolId};
|
||||
REQUIRE(testVariable2.read() == returnvalue::OK);
|
||||
CHECK(testVariable2 == 5);
|
||||
CHECK(testVariable == testVariable2);
|
||||
@ -70,32 +71,30 @@ TEST_CASE("LocalPoolVariable", "[LocPoolVarTest]") {
|
||||
|
||||
SECTION("ErrorHandling") {
|
||||
/* now try to use a local pool variable which does not exist */
|
||||
lp_var_t<uint8_t> invalidVariable =
|
||||
lp_var_t<uint8_t>(objects::TEST_LOCAL_POOL_OWNER_BASE, 0xffffffff);
|
||||
REQUIRE(invalidVariable.read() == static_cast<int>(localpool::POOL_ENTRY_NOT_FOUND));
|
||||
dp::u8_t invalidVariable{objects::TEST_LOCAL_POOL_OWNER_BASE, 0xffffffff};
|
||||
REQUIRE(invalidVariable.read() == static_cast<int>(POOL_ENTRY_NOT_FOUND));
|
||||
|
||||
REQUIRE(invalidVariable.commit() == static_cast<int>(localpool::POOL_ENTRY_NOT_FOUND));
|
||||
REQUIRE(invalidVariable.commit() == static_cast<int>(POOL_ENTRY_NOT_FOUND));
|
||||
/* now try to access with wrong type */
|
||||
lp_var_t<int8_t> invalidVariable2 =
|
||||
lp_var_t<int8_t>(objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId);
|
||||
REQUIRE(invalidVariable2.read() == static_cast<int>(localpool::POOL_ENTRY_TYPE_CONFLICT));
|
||||
dp::i8_t invalidVariable2 = dp::i8_t(objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint8VarId);
|
||||
REQUIRE(invalidVariable2.read() == static_cast<int>(POOL_ENTRY_TYPE_CONFLICT));
|
||||
|
||||
lp_var_t<uint8_t> readOnlyVar = lp_var_t<uint8_t>(
|
||||
dp::var_t<uint8_t> readOnlyVar = dp::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>(
|
||||
dp::var_t<uint8_t> writeOnlyVar = dp::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);
|
||||
dp::var_t<uint32_t> uint32tVar =
|
||||
dp::var_t<uint32_t>(objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint32VarId);
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::info << "LocalPoolVariable printout: " << uint32tVar << std::endl;
|
||||
#endif
|
||||
|
||||
/* for code coverage. If program does not crash -> OK */
|
||||
lp_var_t<uint8_t> invalidObjectVar = lp_var_t<uint8_t>(0xffffffff, lpool::uint8VarId);
|
||||
gp_id_t globPoolId(0xffffffff, lpool::uint8VarId);
|
||||
lp_var_t<uint8_t> invalidObjectVar2 = lp_var_t<uint8_t>(globPoolId);
|
||||
dp::var_t<uint8_t> invalidObjectVar = dp::var_t<uint8_t>(0xffffffff, lpool::uint8VarId);
|
||||
dp::g_id_t globPoolId(0xffffffff, lpool::uint8VarId);
|
||||
dp::var_t<uint8_t> invalidObjectVar2 = dp::var_t<uint8_t>(globPoolId);
|
||||
}
|
||||
}
|
||||
|
@ -1,30 +1,30 @@
|
||||
#include <fsfw/datapoollocal/PeriodicHkGenerationHelper.h>
|
||||
#include <fsfw/objectmanager/ObjectManager.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "CatchDefinitions.h"
|
||||
#include "mocks/LocalPoolOwnerBase.h"
|
||||
#include "mock/TestPoolOwner.h"
|
||||
#include "tests/TestsConfig.h"
|
||||
|
||||
using namespace returnvalue;
|
||||
using namespace dp;
|
||||
using namespace lpool;
|
||||
|
||||
TEST_CASE("LocalPoolVector", "[LocPoolVecTest]") {
|
||||
auto queue = MessageQueueMock(1);
|
||||
LocalPoolOwnerBase poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||
lpool::TestPoolOwner poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||
REQUIRE(poolOwner.initialize() == OK);
|
||||
|
||||
SECTION("BasicTest") {
|
||||
// very basic test.
|
||||
lp_vec_t<uint16_t, 3> testVector =
|
||||
lp_vec_t<uint16_t, 3>(objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint16Vec3Id);
|
||||
vec_t<uint16_t, 3> testVector =
|
||||
vec_t<uint16_t, 3>(objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint16Vec3Id);
|
||||
REQUIRE(testVector.read() == returnvalue::OK);
|
||||
testVector.value[0] = 5;
|
||||
testVector.value[1] = 232;
|
||||
testVector.value[2] = 32023;
|
||||
|
||||
REQUIRE(testVector.commit(true) == returnvalue::OK);
|
||||
// CHECK(testVector.isValid());
|
||||
REQUIRE(testVector.commit() == returnvalue::OK);
|
||||
|
||||
testVector.value[0] = 0;
|
||||
testVector.value[1] = 0;
|
||||
@ -44,7 +44,7 @@ TEST_CASE("LocalPoolVector", "[LocPoolVecTest]") {
|
||||
CHECK(testVector.commit() == returnvalue::OK);
|
||||
|
||||
/* Use read-only reference. */
|
||||
const lp_vec_t<uint16_t, 3>& roTestVec = testVector;
|
||||
const dp::vec_t<uint16_t, 3>& roTestVec = testVector;
|
||||
uint16_t valueOne = roTestVec[0];
|
||||
CHECK(valueOne == 5);
|
||||
|
||||
@ -55,7 +55,7 @@ TEST_CASE("LocalPoolVector", "[LocPoolVecTest]") {
|
||||
CHECK(maxSize == 6);
|
||||
|
||||
uint16_t serializedVector[3];
|
||||
uint8_t* vecPtr = reinterpret_cast<uint8_t*>(serializedVector);
|
||||
auto* vecPtr = reinterpret_cast<uint8_t*>(serializedVector);
|
||||
size_t serSize = 0;
|
||||
REQUIRE(testVector.serialize(&vecPtr, &serSize, maxSize, SerializeIF::Endianness::MACHINE) ==
|
||||
returnvalue::OK);
|
||||
@ -73,7 +73,7 @@ TEST_CASE("LocalPoolVector", "[LocPoolVecTest]") {
|
||||
serializedVector[1] = 7832;
|
||||
serializedVector[2] = 39232;
|
||||
|
||||
const uint8_t* constVecPtr = reinterpret_cast<const uint8_t*>(serializedVector);
|
||||
const auto* constVecPtr = reinterpret_cast<const uint8_t*>(serializedVector);
|
||||
REQUIRE(testVector.deSerialize(&constVecPtr, &serSize, SerializeIF::Endianness::MACHINE) ==
|
||||
returnvalue::OK);
|
||||
CHECK(testVector[0] == 16);
|
||||
@ -87,23 +87,21 @@ TEST_CASE("LocalPoolVector", "[LocPoolVecTest]") {
|
||||
|
||||
SECTION("ErrorHandling") {
|
||||
/* Now try to use a local pool variable which does not exist */
|
||||
lp_vec_t<uint16_t, 3> invalidVector =
|
||||
lp_vec_t<uint16_t, 3>(objects::TEST_LOCAL_POOL_OWNER_BASE, 0xffffffff);
|
||||
REQUIRE(invalidVector.read() == static_cast<int>(localpool::POOL_ENTRY_NOT_FOUND));
|
||||
REQUIRE(invalidVector.commit() == static_cast<int>(localpool::POOL_ENTRY_NOT_FOUND));
|
||||
dp::vec_t<uint16_t, 3> invalidVector{objects::TEST_LOCAL_POOL_OWNER_BASE, 0xffffffff};
|
||||
REQUIRE(invalidVector.read() == static_cast<int>(POOL_ENTRY_NOT_FOUND));
|
||||
REQUIRE(invalidVector.commit() == static_cast<int>(POOL_ENTRY_NOT_FOUND));
|
||||
|
||||
/* Now try to access with wrong type */
|
||||
lp_vec_t<uint32_t, 3> invalidVector2 =
|
||||
lp_vec_t<uint32_t, 3>(objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint16Vec3Id);
|
||||
REQUIRE(invalidVector2.read() == static_cast<int>(localpool::POOL_ENTRY_TYPE_CONFLICT));
|
||||
REQUIRE(invalidVector2.commit() == static_cast<int>(localpool::POOL_ENTRY_TYPE_CONFLICT));
|
||||
dp::vec_t<uint32_t, 3> invalidVector2{objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint16Vec3Id};
|
||||
REQUIRE(invalidVector2.read() == static_cast<int>(POOL_ENTRY_TYPE_CONFLICT));
|
||||
REQUIRE(invalidVector2.commit() == static_cast<int>(POOL_ENTRY_TYPE_CONFLICT));
|
||||
|
||||
lp_vec_t<uint16_t, 3> writeOnlyVec = lp_vec_t<uint16_t, 3>(
|
||||
objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint16Vec3Id, nullptr, pool_rwm_t::VAR_WRITE);
|
||||
dp::vec_t<uint16_t, 3> writeOnlyVec{objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint16Vec3Id,
|
||||
nullptr, pool_rwm_t::VAR_WRITE};
|
||||
REQUIRE(writeOnlyVec.read() == static_cast<int>(PoolVariableIF::INVALID_READ_WRITE_MODE));
|
||||
|
||||
lp_vec_t<uint16_t, 3> readOnlyVec = lp_vec_t<uint16_t, 3>(
|
||||
objects::TEST_LOCAL_POOL_OWNER_BASE, lpool::uint16Vec3Id, nullptr, pool_rwm_t::VAR_READ);
|
||||
dp::vec_t<uint16_t, 3> readOnlyVec = {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));
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
#include <mocks/HkReceiverMock.h>
|
||||
#include <mocks/MessageQueueMock.h>
|
||||
#include <mock/HkReceiverMock.h>
|
||||
#include <mock/MessageQueueMock.h>
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "DeviceHandlerCommander.h"
|
||||
#include "mocks/ComIFMock.h"
|
||||
#include "mocks/CookieIFMock.h"
|
||||
#include "mocks/DeviceFdirMock.h"
|
||||
#include "mocks/DeviceHandlerMock.h"
|
||||
#include "mock/ComIFMock.h"
|
||||
#include "mock/CookieIFMock.h"
|
||||
#include "mock/DeviceFdirMock.h"
|
||||
#include "mock/DeviceHandlerMock.h"
|
||||
#include "objects/systemObjectList.h"
|
||||
|
||||
TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") {
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "fsfw/serialize/SerializeIF.h"
|
||||
#include "mocks/FilesystemMock.h"
|
||||
#include "mock/FilesystemMock.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "fsfw/ipc/CommandMessage.h"
|
||||
#include "fsfw/ipc/MessageQueueMessage.h"
|
||||
#include "fsfw/objectmanager/frameworkObjects.h"
|
||||
#include "mocks/PeriodicTaskIFMock.h"
|
||||
#include "mock/PeriodicTaskIFMock.h"
|
||||
|
||||
TEST_CASE("Internal Error Reporter", "[TestInternalError]") {
|
||||
PeriodicTaskMock task(10, nullptr);
|
||||
|
@ -7,7 +7,6 @@ target_sources(
|
||||
ComIFMock.cpp
|
||||
MessageQueueMock.cpp
|
||||
InternalErrorReporterMock.cpp
|
||||
LocalPoolOwnerBase.cpp
|
||||
PusVerificationReporterMock.cpp
|
||||
PusServiceBaseMock.cpp
|
||||
AcceptsTmMock.cpp
|
||||
@ -16,6 +15,7 @@ target_sources(
|
||||
AcceptsTcMock.cpp
|
||||
StorageManagerMock.cpp
|
||||
FilesystemMock.cpp
|
||||
TestPoolOwner.cpp
|
||||
EventReportingProxyMock.cpp)
|
||||
|
||||
add_subdirectory(cfdp)
|
@ -109,14 +109,13 @@ ReturnValue_t DeviceHandlerMock::initialize() {
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t DeviceHandlerMock::serializeHkDataset(structure_id_t structureId, uint8_t *buf,
|
||||
ReturnValue_t DeviceHandlerMock::serializeHkDataset(dp::structure_id_t structureId, uint8_t *buf,
|
||||
size_t maxSize) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t DeviceHandlerMock::specifyHkDatasets(
|
||||
std::vector<periodicHk::SetSpecification> &setList) {
|
||||
ReturnValue_t DeviceHandlerMock::specifyHkDatasets(std::vector<hk::SetSpecification> &setList) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
localpool::SharedPool *DeviceHandlerMock::getOptionalSharedPool() { return nullptr; }
|
||||
dp::SharedPool *DeviceHandlerMock::getOptionalSharedPool() { return nullptr; }
|
@ -23,11 +23,12 @@ class DeviceHandlerMock : public DeviceHandlerBase {
|
||||
|
||||
ReturnValue_t initialize() override;
|
||||
|
||||
ReturnValue_t serializeHkDataset(sid_t structureId, uint8_t *buf, size_t maxSize) override;
|
||||
ReturnValue_t serializeHkDataset(dp::structure_id_t structureId, uint8_t *buf,
|
||||
size_t maxSize) override;
|
||||
|
||||
ReturnValue_t specifyHkDatasets(std::vector<periodicHk::SetSpecification> &setList) override;
|
||||
ReturnValue_t specifyHkDatasets(std::vector<hk::SetSpecification> &setList) override;
|
||||
|
||||
localpool::SharedPool *getOptionalSharedPool() override;
|
||||
dp::SharedPool *getOptionalSharedPool() override;
|
||||
|
||||
protected:
|
||||
void doStartUp() override;
|
75
unittests/mock/TestPoolOwner.cpp
Normal file
75
unittests/mock/TestPoolOwner.cpp
Normal file
@ -0,0 +1,75 @@
|
||||
#include "TestPoolOwner.h"
|
||||
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
|
||||
using namespace lpool;
|
||||
|
||||
TestPoolOwner::TestPoolOwner(MessageQueueIF &queue, MessageQueueId_t hkDestId, object_id_t objectId)
|
||||
: SystemObject(objectId),
|
||||
hkHelper(this, &queue, hkDestId),
|
||||
sharedPool(TestPoolOwner::getObjectId()),
|
||||
set1(sharedPool, lpool::testSetId1),
|
||||
set2(sharedPool, lpool::testSetId2),
|
||||
queue(queue) {}
|
||||
|
||||
TestPoolOwner::~TestPoolOwner() = default;
|
||||
|
||||
ReturnValue_t TestPoolOwner::initialize() {
|
||||
sharedPool.addPoolEntry(lpool::uint8VarId, &u8PoolEntry);
|
||||
sharedPool.addPoolEntry(lpool::floatVarId, &floatPoolEntry);
|
||||
sharedPool.addPoolEntry(lpool::uint32VarId, &u32PoolEntry);
|
||||
sharedPool.addPoolEntry(lpool::uint16Vec3Id, &u16VecPoolEntry);
|
||||
sharedPool.addPoolEntry(lpool::int64Vec2Id, &i64VecPoolEntry);
|
||||
ReturnValue_t result = hkHelper.initialize(&queue);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
return SystemObject::initialize();
|
||||
}
|
||||
|
||||
SharedPool *TestPoolOwner::getOptionalSharedPool() { return &sharedPool; }
|
||||
|
||||
ReturnValue_t TestPoolOwner::serializeHkDataset(structure_id_t structureId, uint8_t *buf,
|
||||
size_t maxSize) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t TestPoolOwner::specifyHkDatasets(std::vector<hk::SetSpecification> &setList) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t TestPoolOwner::reset() {
|
||||
ReturnValue_t status = returnvalue::OK;
|
||||
{
|
||||
PoolReadGuard readHelper(&set1);
|
||||
if (readHelper.getReadResult() != returnvalue::OK) {
|
||||
status = readHelper.getReadResult();
|
||||
}
|
||||
set1.localPoolVarUint8.value = 0;
|
||||
set1.localPoolVarFloat.value = 0.0;
|
||||
set1.localPoolUint16Vec.value[0] = 0;
|
||||
set1.localPoolUint16Vec.value[1] = 0;
|
||||
set1.localPoolUint16Vec.value[2] = 0;
|
||||
// dataset.setValidity(false, true);
|
||||
}
|
||||
|
||||
{
|
||||
PoolReadGuard readHelper(&testUint32);
|
||||
if (readHelper.getReadResult() != returnvalue::OK) {
|
||||
status = readHelper.getReadResult();
|
||||
}
|
||||
testUint32.value = 0;
|
||||
}
|
||||
|
||||
{
|
||||
PoolReadGuard readHelper(&testInt64Vec);
|
||||
if (readHelper.getReadResult() != returnvalue::OK) {
|
||||
status = readHelper.getReadResult();
|
||||
}
|
||||
testInt64Vec.value[0] = 0;
|
||||
testInt64Vec.value[1] = 0;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
void TestPoolOwner::setHkDestId(MessageQueueId_t id) { hkHelper.setHkDestinationId(id); }
|
64
unittests/mock/TestPoolOwner.h
Normal file
64
unittests/mock/TestPoolOwner.h
Normal file
@ -0,0 +1,64 @@
|
||||
#pragma once
|
||||
#include <fsfw/housekeeping/GeneratesPeriodicHkIF.h>
|
||||
#include <fsfw/objectmanager/SystemObject.h>
|
||||
|
||||
#include "poolDefinitions.h"
|
||||
|
||||
namespace lpool {
|
||||
|
||||
class TestPoolOwner : public SystemObject, public hk::GeneratesPeriodicHkIF {
|
||||
public:
|
||||
explicit TestPoolOwner(MessageQueueIF& queue, MessageQueueId_t hkDestId,
|
||||
object_id_t objectId = objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||
|
||||
~TestPoolOwner() override;
|
||||
|
||||
[[nodiscard]] object_id_t getObjectId() const override { return SystemObject::getObjectId(); }
|
||||
|
||||
ReturnValue_t serializeHkDataset(structure_id_t structureId, uint8_t* buf,
|
||||
size_t maxSize) override;
|
||||
|
||||
ReturnValue_t specifyHkDatasets(std::vector<hk::SetSpecification>& setList) override;
|
||||
|
||||
SharedPool* getOptionalSharedPool() override;
|
||||
ReturnValue_t initialize() override;
|
||||
|
||||
void setHkDestId(MessageQueueId_t id);
|
||||
|
||||
/** Command queue for housekeeping messages. */
|
||||
[[nodiscard]] MessageQueueId_t getCommandQueue() const override { return queue.getId(); }
|
||||
|
||||
[[nodiscard]] MessageQueueMock& getMockQueueHandle() const {
|
||||
return dynamic_cast<MessageQueueMock&>(queue);
|
||||
}
|
||||
|
||||
ReturnValue_t subscribePeriodicHk(bool enableReporting) {
|
||||
return hkHelper.enablePeriodicPacket(lpool::testSid0, 50);
|
||||
}
|
||||
|
||||
ReturnValue_t reset();
|
||||
|
||||
hk::PeriodicHelper hkHelper;
|
||||
SharedPool sharedPool;
|
||||
LocalPoolTestDataSet set1;
|
||||
StaticTestDataSet set2;
|
||||
|
||||
private:
|
||||
PoolEntry<uint8_t> u8PoolEntry = PoolEntry<uint8_t>({0});
|
||||
PoolEntry<float> floatPoolEntry = PoolEntry<float>({0});
|
||||
PoolEntry<uint32_t> u32PoolEntry = PoolEntry<uint32_t>({0});
|
||||
PoolEntry<uint16_t> u16VecPoolEntry = PoolEntry<uint16_t>({0, 0, 0});
|
||||
PoolEntry<int64_t> i64VecPoolEntry = PoolEntry<int64_t>({0, 0});
|
||||
|
||||
dp::u8_t testUint8{sharedPool, lpool::uint8VarId};
|
||||
dp::f32_t testFloat{sharedPool, lpool::floatVarId};
|
||||
dp::u32_t testUint32{sharedPool, lpool::uint32VarId};
|
||||
vec_t<uint16_t, 3> testUint16Vec{sharedPool, lpool::uint16Vec3Id};
|
||||
vec_t<int64_t, 2> testInt64Vec{sharedPool, lpool::int64Vec2Id};
|
||||
|
||||
MessageQueueIF& queue;
|
||||
|
||||
bool initialized = false;
|
||||
bool initializedAfterTaskCreation = false;
|
||||
};
|
||||
} // namespace lpool
|
63
unittests/mock/poolDefinitions.h
Normal file
63
unittests/mock/poolDefinitions.h
Normal file
@ -0,0 +1,63 @@
|
||||
#pragma once
|
||||
|
||||
#include <fsfw/datapool.h>
|
||||
#include <fsfw/ipc/QueueFactory.h>
|
||||
#include <fsfw/objectmanager/SystemObject.h>
|
||||
|
||||
#include "fsfw/datapool/PoolEntry.h"
|
||||
#include "mock/MessageQueueMock.h"
|
||||
#include "tests/TestsConfig.h"
|
||||
|
||||
namespace lpool {
|
||||
|
||||
using namespace dp;
|
||||
|
||||
static constexpr id_t uint8VarId = 0;
|
||||
static constexpr id_t floatVarId = 1;
|
||||
static constexpr id_t uint32VarId = 2;
|
||||
static constexpr id_t uint16Vec3Id = 3;
|
||||
static constexpr id_t int64Vec2Id = 4;
|
||||
|
||||
static constexpr uint32_t testSetId0 = 0;
|
||||
static constexpr uint32_t testSetId1 = 1;
|
||||
static constexpr uint32_t testSetId2 = 2;
|
||||
static constexpr uint8_t dataSetMaxVariables = 10;
|
||||
|
||||
static const auto testSid0 = structure_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, testSetId0);
|
||||
static const auto testSid1 = structure_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, testSetId1);
|
||||
static const auto testSid2 = structure_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, testSetId2);
|
||||
|
||||
static const g_id_t uint8VarGpid = g_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, uint8VarId);
|
||||
static const g_id_t floatVarGpid = g_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, floatVarId);
|
||||
static const g_id_t uint32Gpid = g_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, uint32VarId);
|
||||
static const g_id_t uint16Vec3Gpid = g_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, uint16Vec3Id);
|
||||
static const g_id_t uint64Vec2Id = g_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, int64Vec2Id);
|
||||
|
||||
class StaticTestDataSet : public StaticSharedSet<3> {
|
||||
public:
|
||||
StaticTestDataSet() : StaticSharedSet(lpool::testSid1) {}
|
||||
|
||||
StaticTestDataSet(SharedPool& sharedPool, uint32_t setId) : StaticSharedSet(sharedPool, setId) {}
|
||||
|
||||
u8_t localPoolVarUint8{lpool::uint8VarGpid, this};
|
||||
f32_t localPoolVarFloat{lpool::floatVarGpid, this};
|
||||
vec_t<uint16_t, 3> localPoolUint16Vec{lpool::uint16Vec3Gpid, this};
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
class LocalPoolTestDataSet : public SharedSet {
|
||||
public:
|
||||
LocalPoolTestDataSet() : SharedSet(lpool::testSid2, lpool::dataSetMaxVariables) {}
|
||||
|
||||
LocalPoolTestDataSet(SharedPool& sharedPool, uint32_t setId)
|
||||
: SharedSet(sharedPool, setId, lpool::dataSetMaxVariables) {}
|
||||
|
||||
u8_t localPoolVarUint8{lpool::uint8VarGpid, this};
|
||||
f32_t localPoolVarFloat{lpool::floatVarGpid, this};
|
||||
vec_t<uint16_t, 3> localPoolUint16Vec{lpool::uint16Vec3Gpid, this};
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
} // namespace lpool
|
@ -1,108 +0,0 @@
|
||||
#include "LocalPoolOwnerBase.h"
|
||||
|
||||
#include <fsfw/datapool/PoolReadGuard.h>
|
||||
|
||||
LocalPoolOwnerBase::LocalPoolOwnerBase(MessageQueueIF &queue, MessageQueueId_t hkDestId,
|
||||
object_id_t objectId)
|
||||
: SystemObject(objectId),
|
||||
hkHelper(this, &queue, hkDestId),
|
||||
sharedPool(LocalPoolOwnerBase::getObjectId()),
|
||||
set1(sharedPool, lpool::testSetId1),
|
||||
set2(sharedPool, lpool::testSetId2),
|
||||
queue(queue) {}
|
||||
|
||||
LocalPoolOwnerBase::~LocalPoolOwnerBase() = default;
|
||||
|
||||
ReturnValue_t LocalPoolOwnerBase::initialize() {
|
||||
sharedPool.addPoolEntry(lpool::uint8VarId, &u8PoolEntry);
|
||||
sharedPool.addPoolEntry(lpool::floatVarId, &floatPoolEntry);
|
||||
sharedPool.addPoolEntry(lpool::uint32VarId, &u32PoolEntry);
|
||||
sharedPool.addPoolEntry(lpool::uint16Vec3Id, &u16VecPoolEntry);
|
||||
sharedPool.addPoolEntry(lpool::int64Vec2Id, &i64VecPoolEntry);
|
||||
ReturnValue_t result = hkHelper.initialize(&queue);
|
||||
if (result != returnvalue::OK) {
|
||||
return result;
|
||||
}
|
||||
return SystemObject::initialize();
|
||||
}
|
||||
|
||||
localpool::SharedPool *LocalPoolOwnerBase::getOptionalSharedPool() { return &sharedPool; }
|
||||
|
||||
ReturnValue_t LocalPoolOwnerBase::serializeHkDataset(structure_id_t structureId, uint8_t *buf,
|
||||
size_t maxSize) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t LocalPoolOwnerBase::specifyHkDatasets(
|
||||
std::vector<periodicHk::SetSpecification> &setList) {
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
/*
|
||||
ReturnValue_t LocalPoolOwnerBase::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
|
||||
PeriodicHkGenerationHelper &poolManager) {
|
||||
// Default initialization empty for now.
|
||||
localDataPoolMap.emplace(lpool::uint8VarId, &u8PoolEntry);
|
||||
localDataPoolMap.emplace(lpool::floatVarId, &floatPoolEntry);
|
||||
localDataPoolMap.emplace(lpool::uint32VarId, &u32PoolEntry);
|
||||
|
||||
localDataPoolMap.emplace(lpool::uint16Vec3Id, &u16VecPoolEntry);
|
||||
localDataPoolMap.emplace(lpool::int64Vec2Id, &i64VecPoolEntry);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
*/
|
||||
|
||||
LocalPoolObjectBase *LocalPoolOwnerBase::getPoolObjectHandle(lp_id_t localPoolId) {
|
||||
if (localPoolId == lpool::uint8VarId) {
|
||||
return &testUint8;
|
||||
} else if (localPoolId == lpool::uint16Vec3Id) {
|
||||
return &testUint16Vec;
|
||||
} else if (localPoolId == lpool::floatVarId) {
|
||||
return &testFloat;
|
||||
} else if (localPoolId == lpool::int64Vec2Id) {
|
||||
return &testInt64Vec;
|
||||
} else if (localPoolId == lpool::uint32VarId) {
|
||||
return &testUint32;
|
||||
} else {
|
||||
return &testUint8;
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t LocalPoolOwnerBase::reset() {
|
||||
// resetSubscriptionList();
|
||||
ReturnValue_t status = returnvalue::OK;
|
||||
{
|
||||
PoolReadGuard readHelper(&set1);
|
||||
if (readHelper.getReadResult() != returnvalue::OK) {
|
||||
status = readHelper.getReadResult();
|
||||
}
|
||||
set1.localPoolVarUint8.value = 0;
|
||||
set1.localPoolVarFloat.value = 0.0;
|
||||
set1.localPoolUint16Vec.value[0] = 0;
|
||||
set1.localPoolUint16Vec.value[1] = 0;
|
||||
set1.localPoolUint16Vec.value[2] = 0;
|
||||
// dataset.setValidity(false, true);
|
||||
}
|
||||
|
||||
{
|
||||
PoolReadGuard readHelper(&testUint32);
|
||||
if (readHelper.getReadResult() != returnvalue::OK) {
|
||||
status = readHelper.getReadResult();
|
||||
}
|
||||
testUint32.value = 0;
|
||||
// testUint32.setValid(false);
|
||||
}
|
||||
|
||||
{
|
||||
PoolReadGuard readHelper(&testInt64Vec);
|
||||
if (readHelper.getReadResult() != returnvalue::OK) {
|
||||
status = readHelper.getReadResult();
|
||||
}
|
||||
testInt64Vec.value[0] = 0;
|
||||
testInt64Vec.value[1] = 0;
|
||||
// testInt64Vec.setValid(false);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
void LocalPoolOwnerBase::setHkDestId(MessageQueueId_t id) { hkHelper.setHkDestinationId(id); }
|
@ -1,125 +0,0 @@
|
||||
#ifndef FSFW_UNITTEST_TESTS_DATAPOOLLOCAL_LOCALPOOLOWNERBASE_H_
|
||||
#define FSFW_UNITTEST_TESTS_DATAPOOLLOCAL_LOCALPOOLOWNERBASE_H_
|
||||
|
||||
#include <fsfw/datapoollocal/LocalPoolVector.h>
|
||||
#include <fsfw/datapoollocal/PeriodicHkGenerationHelper.h>
|
||||
#include <fsfw/datapoollocal/PoolVariable.h>
|
||||
#include <fsfw/datapoollocal/SharedDataset.h>
|
||||
#include <fsfw/datapoollocal/StaticSharedDataset.h>
|
||||
#include <fsfw/ipc/QueueFactory.h>
|
||||
#include <fsfw/objectmanager/SystemObject.h>
|
||||
|
||||
#include "fsfw/datapool/PoolEntry.h"
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
#include "tests/TestsConfig.h"
|
||||
|
||||
namespace lpool {
|
||||
static constexpr lp_id_t uint8VarId = 0;
|
||||
static constexpr lp_id_t floatVarId = 1;
|
||||
static constexpr lp_id_t uint32VarId = 2;
|
||||
static constexpr lp_id_t uint16Vec3Id = 3;
|
||||
static constexpr lp_id_t int64Vec2Id = 4;
|
||||
|
||||
static constexpr uint32_t testSetId0 = 0;
|
||||
static constexpr uint32_t testSetId1 = 1;
|
||||
static constexpr uint32_t testSetId2 = 2;
|
||||
static constexpr uint8_t dataSetMaxVariables = 10;
|
||||
|
||||
static const auto testSid0 = structure_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, testSetId0);
|
||||
static const auto testSid1 = structure_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, testSetId1);
|
||||
static const auto testSid2 = structure_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, testSetId2);
|
||||
|
||||
static const gp_id_t uint8VarGpid = gp_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, uint8VarId);
|
||||
static const gp_id_t floatVarGpid = gp_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, floatVarId);
|
||||
static const gp_id_t uint32Gpid = gp_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, uint32VarId);
|
||||
static const gp_id_t uint16Vec3Gpid = gp_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, uint16Vec3Id);
|
||||
static const gp_id_t uint64Vec2Id = gp_id_t(objects::TEST_LOCAL_POOL_OWNER_BASE, int64Vec2Id);
|
||||
} // namespace lpool
|
||||
|
||||
class LocalPoolStaticTestDataSet : public StaticSharedDataset<3> {
|
||||
public:
|
||||
LocalPoolStaticTestDataSet() : StaticSharedDataset(lpool::testSid1) {}
|
||||
|
||||
LocalPoolStaticTestDataSet(localpool::SharedPool& sharedPool, uint32_t setId)
|
||||
: StaticSharedDataset(sharedPool, setId) {}
|
||||
|
||||
lp_var_t<uint8_t> localPoolVarUint8 = lp_var_t<uint8_t>(lpool::uint8VarGpid, this);
|
||||
lp_var_t<float> localPoolVarFloat = lp_var_t<float>(lpool::floatVarGpid, this);
|
||||
lp_vec_t<uint16_t, 3> localPoolUint16Vec = lp_vec_t<uint16_t, 3>(lpool::uint16Vec3Gpid, this);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
class LocalPoolTestDataSet : public SharedDataSet {
|
||||
public:
|
||||
LocalPoolTestDataSet() : SharedDataSet(lpool::testSid2, lpool::dataSetMaxVariables) {}
|
||||
|
||||
LocalPoolTestDataSet(localpool::SharedPool& sharedPool, uint32_t setId)
|
||||
: SharedDataSet(sharedPool, setId, lpool::dataSetMaxVariables) {}
|
||||
|
||||
lp_var_t<uint8_t> localPoolVarUint8 = lp_var_t<uint8_t>(lpool::uint8VarGpid, this);
|
||||
lp_var_t<float> localPoolVarFloat = lp_var_t<float>(lpool::floatVarGpid, this);
|
||||
lp_vec_t<uint16_t, 3> localPoolUint16Vec = lp_vec_t<uint16_t, 3>(lpool::uint16Vec3Gpid, this);
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
class LocalPoolOwnerBase : public SystemObject, public PeriodicHkGenerationIF {
|
||||
public:
|
||||
explicit LocalPoolOwnerBase(MessageQueueIF& queue, MessageQueueId_t hkDestId,
|
||||
object_id_t objectId = objects::TEST_LOCAL_POOL_OWNER_BASE);
|
||||
|
||||
~LocalPoolOwnerBase() override;
|
||||
|
||||
[[nodiscard]] object_id_t getObjectId() const override { return SystemObject::getObjectId(); }
|
||||
|
||||
ReturnValue_t serializeHkDataset(structure_id_t structureId, uint8_t* buf,
|
||||
size_t maxSize) override;
|
||||
|
||||
ReturnValue_t specifyHkDatasets(std::vector<periodicHk::SetSpecification>& setList) override;
|
||||
|
||||
localpool::SharedPool* getOptionalSharedPool() override;
|
||||
ReturnValue_t initialize() override;
|
||||
|
||||
void setHkDestId(MessageQueueId_t id);
|
||||
|
||||
/** Command queue for housekeeping messages. */
|
||||
[[nodiscard]] MessageQueueId_t getCommandQueue() const override { return queue.getId(); }
|
||||
|
||||
LocalPoolObjectBase* getPoolObjectHandle(lp_id_t localPoolId) override;
|
||||
|
||||
[[nodiscard]] MessageQueueMock& getMockQueueHandle() const {
|
||||
return dynamic_cast<MessageQueueMock&>(queue);
|
||||
}
|
||||
|
||||
ReturnValue_t subscribePeriodicHk(bool enableReporting) {
|
||||
return hkHelper.enablePeriodicPacket(lpool::testSid0, 50);
|
||||
}
|
||||
|
||||
ReturnValue_t reset();
|
||||
|
||||
PeriodicHkGenerationHelper hkHelper;
|
||||
localpool::SharedPool sharedPool;
|
||||
LocalPoolTestDataSet set1;
|
||||
LocalPoolStaticTestDataSet set2;
|
||||
|
||||
private:
|
||||
PoolEntry<uint8_t> u8PoolEntry = PoolEntry<uint8_t>({0});
|
||||
PoolEntry<float> floatPoolEntry = PoolEntry<float>({0});
|
||||
PoolEntry<uint32_t> u32PoolEntry = PoolEntry<uint32_t>({0});
|
||||
PoolEntry<uint16_t> u16VecPoolEntry = PoolEntry<uint16_t>({0, 0, 0});
|
||||
PoolEntry<int64_t> i64VecPoolEntry = PoolEntry<int64_t>({0, 0});
|
||||
|
||||
lp_var_t<uint8_t> testUint8 = lp_var_t<uint8_t>(sharedPool, lpool::uint8VarId);
|
||||
lp_var_t<float> testFloat = lp_var_t<float>(sharedPool, lpool::floatVarId);
|
||||
lp_var_t<uint32_t> testUint32 = lp_var_t<uint32_t>(sharedPool, lpool::uint32VarId);
|
||||
lp_vec_t<uint16_t, 3> testUint16Vec = lp_vec_t<uint16_t, 3>(sharedPool, lpool::uint16Vec3Id);
|
||||
lp_vec_t<int64_t, 2> testInt64Vec = lp_vec_t<int64_t, 2>(sharedPool, lpool::int64Vec2Id);
|
||||
|
||||
MessageQueueIF& queue;
|
||||
|
||||
bool initialized = false;
|
||||
bool initializedAfterTaskCreation = false;
|
||||
};
|
||||
|
||||
#endif /* FSFW_UNITTEST_TESTS_DATAPOOLLOCAL_LOCALPOOLOWNERBASE_H_ */
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "mocks/PowerSwitcherMock.h"
|
||||
#include "mock/PowerSwitcherMock.h"
|
||||
#include "objects/systemObjectList.h"
|
||||
|
||||
TEST_CASE("Power Switcher", "[power-switcher]") {
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <array>
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
|
||||
#include "mocks/SimpleSerializable.h"
|
||||
#include "mock/SimpleSerializable.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -4,9 +4,9 @@
|
||||
#include "fsfw/storagemanager/LocalPool.h"
|
||||
#include "fsfw/tcdistribution/CcsdsDistributor.h"
|
||||
#include "fsfw/tmtcpacket/ccsds/SpacePacketCreator.h"
|
||||
#include "mocks/AcceptsTcMock.h"
|
||||
#include "mocks/CcsdsCheckerMock.h"
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
#include "mock/AcceptsTcMock.h"
|
||||
#include "mock/CcsdsCheckerMock.h"
|
||||
#include "mock/MessageQueueMock.h"
|
||||
|
||||
TEST_CASE("CCSDS Distributor", "[ccsds][tmtcdistrib]") {
|
||||
LocalPool::LocalPoolConfig cfg = {{5, 32}, {2, 64}};
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include "fsfw/globalfunctions/CRC.h"
|
||||
#include "fsfw/tmtcpacket/pus/tc.h"
|
||||
#include "mocks/SimpleSerializable.h"
|
||||
#include "mock/SimpleSerializable.h"
|
||||
|
||||
TEST_CASE("PUS TC Creator", "[pus-tc-creator]") {
|
||||
auto packetId = PacketId(ccsds::PacketType::TC, true, 0x02);
|
||||
|
@ -3,8 +3,8 @@
|
||||
#include "fsfw/globalfunctions/CRC.h"
|
||||
#include "fsfw/globalfunctions/arrayprinter.h"
|
||||
#include "fsfw/tmtcpacket/pus/tm.h"
|
||||
#include "mocks/CdsShortTimestamperMock.h"
|
||||
#include "mocks/SimpleSerializable.h"
|
||||
#include "mock/CdsShortTimestamperMock.h"
|
||||
#include "mock/SimpleSerializable.h"
|
||||
|
||||
TEST_CASE("PUS TM Creator", "[pus-tm-creator]") {
|
||||
auto packetId = PacketId(ccsds::PacketType::TC, true, 0xef);
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include "fsfw/tmtcpacket/pus/tm/PusTmCreator.h"
|
||||
#include "fsfw/tmtcpacket/pus/tm/PusTmReader.h"
|
||||
#include "mocks/CdsShortTimestamperMock.h"
|
||||
#include "mock/CdsShortTimestamperMock.h"
|
||||
|
||||
TEST_CASE("PUS TM Reader", "[pus-tm-reader]") {
|
||||
auto packetId = PacketId(ccsds::PacketType::TC, true, 0xef);
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include "fsfw/globalfunctions/CRC.h"
|
||||
#include "fsfw/tmtcpacket/pus/tm.h"
|
||||
#include "fsfw/tmtcpacket/pus/tm/PusTmZcWriter.h"
|
||||
#include "mocks/CdsShortTimestamperMock.h"
|
||||
#include "mock/CdsShortTimestamperMock.h"
|
||||
|
||||
TEST_CASE("TM ZC Helper", "[tm-zc-helper]") {
|
||||
auto packetId = PacketId(ccsds::PacketType::TC, true, 0xef);
|
||||
|
@ -3,13 +3,13 @@
|
||||
#include "fsfw/ipc/QueueFactory.h"
|
||||
#include "fsfw/storagemanager/LocalPool.h"
|
||||
#include "fsfw/storagemanager/PoolManager.h"
|
||||
#include "mocks/AcceptsTmMock.h"
|
||||
#include "mocks/CdsShortTimestamperMock.h"
|
||||
#include "mocks/InternalErrorReporterMock.h"
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
#include "mocks/PusDistributorMock.h"
|
||||
#include "mocks/PusServiceBaseMock.h"
|
||||
#include "mocks/PusVerificationReporterMock.h"
|
||||
#include "mock/AcceptsTmMock.h"
|
||||
#include "mock/CdsShortTimestamperMock.h"
|
||||
#include "mock/InternalErrorReporterMock.h"
|
||||
#include "mock/MessageQueueMock.h"
|
||||
#include "mock/PusDistributorMock.h"
|
||||
#include "mock/PusServiceBaseMock.h"
|
||||
#include "mock/PusVerificationReporterMock.h"
|
||||
|
||||
TEST_CASE("Pus Service Base", "[pus-service-base]") {
|
||||
uint16_t apid = 2;
|
||||
|
@ -3,9 +3,9 @@
|
||||
#include "fsfw/storagemanager/LocalPool.h"
|
||||
#include "fsfw/tmtcservices/TmSendHelper.h"
|
||||
#include "fsfw/tmtcservices/TmStoreHelper.h"
|
||||
#include "mocks/CdsShortTimestamperMock.h"
|
||||
#include "mocks/InternalErrorReporterMock.h"
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
#include "mock/CdsShortTimestamperMock.h"
|
||||
#include "mock/InternalErrorReporterMock.h"
|
||||
#include "mock/MessageQueueMock.h"
|
||||
|
||||
TEST_CASE("TM Send Helper", "[tm-send-helper]") {
|
||||
MessageQueueId_t destId = 2;
|
||||
|
@ -4,10 +4,10 @@
|
||||
#include "fsfw/tmtcservices/TmSendHelper.h"
|
||||
#include "fsfw/tmtcservices/TmStoreAndSendHelper.h"
|
||||
#include "fsfw/tmtcservices/TmStoreHelper.h"
|
||||
#include "mocks/CdsShortTimestamperMock.h"
|
||||
#include "mocks/InternalErrorReporterMock.h"
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
#include "mocks/SimpleSerializable.h"
|
||||
#include "mock/CdsShortTimestamperMock.h"
|
||||
#include "mock/InternalErrorReporterMock.h"
|
||||
#include "mock/MessageQueueMock.h"
|
||||
#include "mock/SimpleSerializable.h"
|
||||
|
||||
TEST_CASE("TM Store And Send Helper", "[tm-store-send-helper]") {
|
||||
auto timeStamper = CdsShortTimestamperMock();
|
||||
|
@ -3,8 +3,8 @@
|
||||
#include "fsfw/storagemanager/LocalPool.h"
|
||||
#include "fsfw/tmtcservices/TmStoreHelper.h"
|
||||
#include "fsfw/tmtcservices/tmHelpers.h"
|
||||
#include "mocks/CdsShortTimestamperMock.h"
|
||||
#include "mocks/SimpleSerializable.h"
|
||||
#include "mock/CdsShortTimestamperMock.h"
|
||||
#include "mock/SimpleSerializable.h"
|
||||
|
||||
TEST_CASE("TM Store Helper", "[tm-store-helper]") {
|
||||
auto timeStamper = CdsShortTimestamperMock();
|
||||
|
Reference in New Issue
Block a user