some more tests using TM send helper
This commit is contained in:
parent
586993c081
commit
c83f75c515
@ -1,11 +1,16 @@
|
||||
#include "tmHelpers.h"
|
||||
|
||||
ReturnValue_t telemetry::storeAndSendTmPacket(TmStoreHelper &storeHelper,
|
||||
TmSendHelper &sendHelper) {
|
||||
storeHelper.addPacketToStore();
|
||||
ReturnValue_t result = sendHelper.sendPacket(storeHelper.getCurrentAddr());
|
||||
ReturnValue_t telemetry::storeAndSendTmPacket(TmStoreHelper &storeHelper, TmSendHelper &sendHelper,
|
||||
bool delOnFailure) {
|
||||
ReturnValue_t result = storeHelper.addPacketToStore();
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
storeHelper.deletePacket();
|
||||
return result;
|
||||
}
|
||||
result = sendHelper.sendPacket(storeHelper.getCurrentAddr());
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
if (delOnFailure) {
|
||||
storeHelper.deletePacket();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -7,7 +7,8 @@
|
||||
// I'd prefer to use tm, but there have been nameclashes with the tm struct
|
||||
namespace telemetry {
|
||||
|
||||
ReturnValue_t storeAndSendTmPacket(TmStoreHelper& storeHelper, TmSendHelper& sendHelper);
|
||||
ReturnValue_t storeAndSendTmPacket(TmStoreHelper& storeHelper, TmSendHelper& sendHelper,
|
||||
bool delOnFailure = true);
|
||||
|
||||
class DataWithObjectIdPrefix : public SerializeIF {
|
||||
public:
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include <catch2/catch_test_macros.hpp>
|
||||
#include <iostream>
|
||||
|
||||
#include "fsfw/storagemanager/LocalPool.h"
|
||||
#include "fsfw/tmtcservices/TmSendHelper.h"
|
||||
#include "fsfw/tmtcservices/TmStoreHelper.h"
|
||||
#include "fsfw/tmtcservices/tmHelpers.h"
|
||||
#include "mocks/CdsShortTimestamperMock.h"
|
||||
#include "mocks/InternalErrorReporterMock.h"
|
||||
#include "mocks/MessageQueueMock.h"
|
||||
@ -61,10 +61,18 @@ TEST_CASE("TM Send Helper", "[tm-send-helper]") {
|
||||
REQUIRE(helper.getMsgQueue() == &msgQueue);
|
||||
}
|
||||
SECTION("Send") {
|
||||
storeHelper.preparePacket(17, 2, 0);
|
||||
REQUIRE(storeHelper.addPacketToStore() == HasReturnvaluesIF::RETURN_OK);
|
||||
store_address_t storeId = storeHelper.getCurrentAddr();
|
||||
REQUIRE(sendHelper.sendPacket(storeId) == HasReturnvaluesIF::RETURN_OK);
|
||||
REQUIRE(storeHelper.preparePacket(17, 2, 0) == HasReturnvaluesIF::RETURN_OK);
|
||||
store_address_t storeId;
|
||||
SECTION("Separate Helpers") {
|
||||
REQUIRE(storeHelper.addPacketToStore() == HasReturnvaluesIF::RETURN_OK);
|
||||
storeId = storeHelper.getCurrentAddr();
|
||||
REQUIRE(sendHelper.sendPacket(storeId) == HasReturnvaluesIF::RETURN_OK);
|
||||
}
|
||||
SECTION("Helper Wrapper") {
|
||||
REQUIRE(telemetry::storeAndSendTmPacket(storeHelper, sendHelper) ==
|
||||
HasReturnvaluesIF::RETURN_OK);
|
||||
storeId = storeHelper.getCurrentAddr();
|
||||
}
|
||||
REQUIRE(msgQueue.wasMessageSent());
|
||||
REQUIRE(msgQueue.numberOfSentMessagesToDefault() == 1);
|
||||
TmTcMessage msg;
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include "fsfw/storagemanager/LocalPool.h"
|
||||
#include "fsfw/tmtcservices/TmStoreHelper.h"
|
||||
#include "fsfw/tmtcservices/tmHelpers.h"
|
||||
#include "mocks/CdsShortTimestamperMock.h"
|
||||
#include "mocks/SimpleSerializable.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user