Refactor TMTC Stack, improve test framework #655

Merged
mohr merged 150 commits from mueller/refactor-tmtc-stack into development 2022-09-12 14:31:23 +02:00
2 changed files with 13 additions and 0 deletions
Showing only changes of commit 8f6f0e1d45 - Show all commits

View File

@ -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) {

View File

@ -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<uint8_t, 80> 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();