From 8f6f0e1d458236219f6570e0212d58dbc5de14da Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 28 Jul 2022 13:42:34 +0200 Subject: [PATCH] some more fail tests --- src/fsfw/tmtcservices/TmStoreAndSendHelper.cpp | 6 ++++++ unittests/tmtcservices/testStoreAndSendHelper.cpp | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/fsfw/tmtcservices/TmStoreAndSendHelper.cpp b/src/fsfw/tmtcservices/TmStoreAndSendHelper.cpp index cab6db44..7d4c61d6 100644 --- a/src/fsfw/tmtcservices/TmStoreAndSendHelper.cpp +++ b/src/fsfw/tmtcservices/TmStoreAndSendHelper.cpp @@ -6,6 +6,12 @@ TmStoreAndSendWrapper::TmStoreAndSendWrapper(uint8_t defaultService, TmStoreHelp TmSendHelper& sendHelper) : storeHelper(storeHelper), sendHelper(sendHelper), defaultService(defaultService) {} +/** + * Helper wrapper which stores the TM packet into the store and then sends it. + * @return + * - StorageManagerIF returnvalue if storage fails + * - MessageQueueIF returnvalue if sending fails + */ ReturnValue_t TmStoreAndSendWrapper::storeAndSendTmPacket() { ReturnValue_t result = storeHelper.addPacketToStore(); if (result != HasReturnvaluesIF::RETURN_OK) { diff --git a/unittests/tmtcservices/testStoreAndSendHelper.cpp b/unittests/tmtcservices/testStoreAndSendHelper.cpp index 048ee092..1163c33d 100644 --- a/unittests/tmtcservices/testStoreAndSendHelper.cpp +++ b/unittests/tmtcservices/testStoreAndSendHelper.cpp @@ -31,6 +31,13 @@ TEST_CASE("TM Store And Send Helper", "[tm-store-send-helper]") { CHECK(&tmHelper.storeHelper == &storeHelper); } + SECTION("Storage Fails") { + // Too large to fit in store + std::array data{}; + REQUIRE(storeHelper.setSourceDataRaw(data.data(), data.size()) == result::OK); + REQUIRE(tmHelper.storeAndSendTmPacket() == StorageManagerIF::DATA_TOO_LARGE); + } + SECTION("Base Test") { tmHelper.prepareTmPacket(2); auto& creator = storeHelper.getCreatorRef();