tests are working again

This commit is contained in:
2024-11-07 13:32:09 +01:00
parent 639b210666
commit b619c1f06f
15 changed files with 22 additions and 25 deletions

View File

@ -11,7 +11,7 @@
TEST_CASE("Action Helper", "[action]") { TEST_CASE("Action Helper", "[action]") {
ActionHelperOwnerMockBase testDhMock; ActionHelperOwnerMockBase testDhMock;
// TODO: Setting another number here breaks the test. Find out why // TODO: Setting another number here breaks the test. Find out why
MessageQueueMock testMqMock(MessageQueueIF::NO_QUEUE); MessageQueueMock testMqMock(MessageQueueIF::NO_QUEUE, MessageQueueIF::NO_QUEUE);
ActionHelper actionHelper = ActionHelper(&testDhMock, dynamic_cast<MessageQueueIF*>(&testMqMock)); ActionHelper actionHelper = ActionHelper(&testDhMock, dynamic_cast<MessageQueueIF*>(&testMqMock));
CommandMessage actionMessage; CommandMessage actionMessage;
ActionId_t testActionId = 777; ActionId_t testActionId = 777;

View File

@ -24,7 +24,7 @@ TEST_CASE("CFDP Dest Handler", "[cfdp]") {
using namespace returnvalue; using namespace returnvalue;
MessageQueueId_t destQueueId = 2; MessageQueueId_t destQueueId = 2;
AcceptsTmMock tmReceiver(destQueueId); AcceptsTmMock tmReceiver(destQueueId);
MessageQueueMock mqMock(destQueueId); MessageQueueMock mqMock(destQueueId, MessageQueueIF::NO_QUEUE);
auto localId = EntityId(UnsignedByteField<uint16_t>(2)); auto localId = EntityId(UnsignedByteField<uint16_t>(2));
auto remoteId = EntityId(UnsignedByteField<uint16_t>(3)); auto remoteId = EntityId(UnsignedByteField<uint16_t>(3));
FaultHandlerMock fhMock; FaultHandlerMock fhMock;

View File

@ -12,7 +12,7 @@
TEST_CASE("CFDP Distributor", "[cfdp][distributor]") { TEST_CASE("CFDP Distributor", "[cfdp][distributor]") {
LocalPool::LocalPoolConfig cfg = {{5, 32}, {2, 64}}; LocalPool::LocalPoolConfig cfg = {{5, 32}, {2, 64}};
StorageManagerMock pool(objects::NO_OBJECT, cfg); StorageManagerMock pool(objects::NO_OBJECT, cfg);
auto queue = MessageQueueMock(1); auto queue = MessageQueueMock(1, MessageQueueIF::NO_QUEUE);
CfdpDistribCfg distribCfg(1, pool, &queue); CfdpDistribCfg distribCfg(1, pool, &queue);
auto distributor = CfdpDistributor(distribCfg); auto distributor = CfdpDistributor(distribCfg);
auto obswEntityId = cfdp::EntityId(UnsignedByteField<uint16_t>(2)); auto obswEntityId = cfdp::EntityId(UnsignedByteField<uint16_t>(2));

View File

@ -20,7 +20,7 @@ TEST_CASE("Reserved Message Parser", "[cfdp]") {
std::string srcFileName = "hello.txt"; std::string srcFileName = "hello.txt";
std::string destFileName = "hello2.txt"; std::string destFileName = "hello2.txt";
MessageQueueId_t destQueueId = 2; MessageQueueId_t destQueueId = 2;
MessageQueueMock msgQueue(1); MessageQueueMock msgQueue(1, destQueueId);
LocalPool::LocalPoolConfig storeCfg = {{10, 32}, {10, 64}, {10, 128}, {10, 1024}}; LocalPool::LocalPoolConfig storeCfg = {{10, 32}, {10, 64}, {10, 128}, {10, 1024}};
StorageManagerMock ipcStore(0, storeCfg); StorageManagerMock ipcStore(0, storeCfg);
std::array<uint8_t, 128> buffer{}; std::array<uint8_t, 128> buffer{};

View File

@ -15,7 +15,7 @@ using namespace returnvalue;
using namespace lpool; using namespace lpool;
TEST_CASE("DataSetTest", "[DataSetTest]") { TEST_CASE("DataSetTest", "[DataSetTest]") {
auto queue = MessageQueueMock(1); auto queue = MessageQueueMock(1, MessageQueueIF::NO_QUEUE);
TestPoolOwner poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE); TestPoolOwner poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
poolOwner.initialize(); poolOwner.initialize();
StaticTestDataset localSet; StaticTestDataset localSet;

View File

@ -16,12 +16,11 @@
using namespace lpool; using namespace lpool;
TEST_CASE("Pool Owner and Periodic HK", "[datapool]") { TEST_CASE("Pool Owner and Periodic HK", "[datapool]") {
constexpr MessageQueueId_t defaultDestId = 1; constexpr MessageQueueId_t DEFAULT_DEST_ID = 1;
constexpr MessageQueueId_t hkDest = defaultDestId; constexpr MessageQueueId_t HK_DEST = DEFAULT_DEST_ID;
const MessageQueueId_t subscriberId = 2; auto hkReceiver = HkReceiverMock(HK_DEST);
auto hkReceiver = HkReceiverMock(hkDest); auto queue = MessageQueueMock(3, HK_DEST);
auto queue = MessageQueueMock(3); TestPoolOwner poolOwner(queue, HK_DEST, objects::TEST_LOCAL_POOL_OWNER_BASE);
TestPoolOwner poolOwner(queue, hkDest, objects::TEST_LOCAL_POOL_OWNER_BASE);
REQUIRE(poolOwner.initialize() == returnvalue::OK); REQUIRE(poolOwner.initialize() == returnvalue::OK);

View File

@ -12,7 +12,7 @@ using namespace lpool;
using namespace dp; using namespace dp;
TEST_CASE("LocalPoolVariable", "[LocPoolVarTest]") { TEST_CASE("LocalPoolVariable", "[LocPoolVarTest]") {
auto queue = MessageQueueMock(1); auto queue = MessageQueueMock(1, MessageQueueIF::NO_QUEUE);
lpool::TestPoolOwner poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE); lpool::TestPoolOwner poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
REQUIRE(poolOwner.initialize() == OK); REQUIRE(poolOwner.initialize() == OK);

View File

@ -11,7 +11,7 @@ using namespace dp;
using namespace lpool; using namespace lpool;
TEST_CASE("LocalPoolVector", "[LocPoolVecTest]") { TEST_CASE("LocalPoolVector", "[LocPoolVecTest]") {
auto queue = MessageQueueMock(1); auto queue = MessageQueueMock(1, MessageQueueIF::NO_QUEUE);
lpool::TestPoolOwner poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE); lpool::TestPoolOwner poolOwner(queue, objects::TEST_LOCAL_POOL_OWNER_BASE);
REQUIRE(poolOwner.initialize() == OK); REQUIRE(poolOwner.initialize() == OK);

View File

@ -14,7 +14,7 @@ TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") {
// Will be deleted with DHB destructor // Will be deleted with DHB destructor
auto* cookieIFMock = new CookieIFMock; auto* cookieIFMock = new CookieIFMock;
ComIFMock comIF(objects::COM_IF_MOCK); ComIFMock comIF(objects::COM_IF_MOCK);
MessageQueueMock mqMock(1); MessageQueueMock mqMock(1, MessageQueueIF::NO_QUEUE);
HkReceiverMock hkReceiver(1); HkReceiverMock hkReceiver(1);
DeviceFdirMock deviceFdirMock(objects::DEVICE_HANDLER_MOCK, objects::NO_OBJECT); DeviceFdirMock deviceFdirMock(objects::DEVICE_HANDLER_MOCK, objects::NO_OBJECT);
DeviceHandlerMock deviceHandlerMock(objects::DEVICE_HANDLER_MOCK, objects::COM_IF_MOCK, DeviceHandlerMock deviceHandlerMock(objects::DEVICE_HANDLER_MOCK, objects::COM_IF_MOCK,

View File

@ -3,8 +3,8 @@
#include <algorithm> #include <algorithm>
#include <stdexcept> #include <stdexcept>
MessageQueueMock::MessageQueueMock(MessageQueueId_t queueId) MessageQueueMock::MessageQueueMock(MessageQueueId_t queueId, MessageQueueId_t defaultDest)
: MessageQueueBase(queueId, MessageQueueIF::NO_QUEUE, nullptr) {} : MessageQueueBase(queueId, defaultDest, nullptr) {}
bool MessageQueueMock::wasMessageSent() const { bool MessageQueueMock::wasMessageSent() const {
return std::any_of( return std::any_of(

View File

@ -23,7 +23,7 @@ struct SendInfo {
class MessageQueueMock : public MessageQueueBase { class MessageQueueMock : public MessageQueueBase {
public: public:
void addReceivedMessage(MessageQueueMessageIF& msg); void addReceivedMessage(MessageQueueMessageIF& msg);
explicit MessageQueueMock(MessageQueueId_t queueId); explicit MessageQueueMock(MessageQueueId_t queueId, MessageQueueId_t defaultDest);
//! Get next message which was sent to the default destination //! Get next message which was sent to the default destination
ReturnValue_t getNextSentMessageToDefaultDest(MessageQueueMessageIF& message); ReturnValue_t getNextSentMessageToDefaultDest(MessageQueueMessageIF& message);

View File

@ -11,7 +11,7 @@
TEST_CASE("CCSDS Distributor", "[ccsds][tmtcdistrib]") { TEST_CASE("CCSDS Distributor", "[ccsds][tmtcdistrib]") {
LocalPool::LocalPoolConfig cfg = {{5, 32}, {2, 64}}; LocalPool::LocalPoolConfig cfg = {{5, 32}, {2, 64}};
LocalPool pool(objects::NO_OBJECT, cfg); LocalPool pool(objects::NO_OBJECT, cfg);
auto queue = MessageQueueMock(1); auto queue = MessageQueueMock(1, MessageQueueIF::NO_QUEUE);
auto checkerMock = CcsdsCheckerMock(); auto checkerMock = CcsdsCheckerMock();
uint16_t unregisteredApid = 0; uint16_t unregisteredApid = 0;
uint16_t defaultApid = 4; uint16_t defaultApid = 4;

View File

@ -14,7 +14,7 @@
TEST_CASE("Pus Service Base", "[pus-service-base]") { TEST_CASE("Pus Service Base", "[pus-service-base]") {
uint16_t apid = 2; uint16_t apid = 2;
auto verificationReporter = PusVerificationReporterMock(); auto verificationReporter = PusVerificationReporterMock();
auto msgQueue = MessageQueueMock(1); auto msgQueue = MessageQueueMock(1, MessageQueueIF::NO_QUEUE);
auto tmReceiver = AcceptsTmMock(2); auto tmReceiver = AcceptsTmMock(2);
auto psbParams = PsbParams(0, apid, 17); auto psbParams = PsbParams(0, apid, 17);
@ -117,7 +117,7 @@ TEST_CASE("Pus Service Base", "[pus-service-base]") {
} }
SECTION("Set Request Queue") { SECTION("Set Request Queue") {
auto msgQueueMock = MessageQueueMock(2); auto msgQueueMock = MessageQueueMock(2, MessageQueueIF::NO_QUEUE);
psb.setRequestQueue(msgQueueMock); psb.setRequestQueue(msgQueueMock);
auto& p = psb.getParams(); auto& p = psb.getParams();
REQUIRE(p.reqQueue == &msgQueueMock); REQUIRE(p.reqQueue == &msgQueueMock);

View File

@ -10,8 +10,7 @@
TEST_CASE("TM Send Helper", "[tm-send-helper]") { TEST_CASE("TM Send Helper", "[tm-send-helper]") {
MessageQueueId_t destId = 2; MessageQueueId_t destId = 2;
auto errReporter = InternalErrorReporterMock(); auto errReporter = InternalErrorReporterMock();
auto msgQueue = MessageQueueMock(1); auto msgQueue = MessageQueueMock(1, destId);
msgQueue.setDefaultDestination(destId);
TmSendHelper sendHelper(msgQueue, errReporter, destId); TmSendHelper sendHelper(msgQueue, errReporter, destId);
auto timeStamper = CdsShortTimestamperMock(); auto timeStamper = CdsShortTimestamperMock();
LocalPool::LocalPoolConfig cfg = {{5, 32}, {2, 64}}; LocalPool::LocalPoolConfig cfg = {{5, 32}, {2, 64}};

View File

@ -17,8 +17,7 @@ TEST_CASE("TM Store And Send Helper", "[tm-store-send-helper]") {
MessageQueueId_t destId = 1; MessageQueueId_t destId = 1;
auto errReporter = InternalErrorReporterMock(); auto errReporter = InternalErrorReporterMock();
auto msgQueue = MessageQueueMock(2); auto msgQueue = MessageQueueMock(2, destId);
msgQueue.setDefaultDestination(destId);
TmSendHelper sendHelper(msgQueue, errReporter, destId); TmSendHelper sendHelper(msgQueue, errReporter, destId);
TmStoreAndSendWrapper tmHelper(17, storeHelper, sendHelper); TmStoreAndSendWrapper tmHelper(17, storeHelper, sendHelper);