some more fail tests

This commit is contained in:
Robin Müller 2022-07-28 13:42:34 +02:00
parent 1b5fa2a8fa
commit 8f6f0e1d45
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 13 additions and 0 deletions

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();