1
0
forked from fsfw/fsfw

new cfdp mock folder, added additional cfdp mocks

This commit is contained in:
2022-08-09 19:00:47 +02:00
parent d45108e3c2
commit 0cb15e901e
11 changed files with 97 additions and 23 deletions

View File

@ -0,0 +1,37 @@
#ifndef FSFW_TESTS_FAULTHANDLERMOCK_H
#define FSFW_TESTS_FAULTHANDLERMOCK_H
#include <map>
#include <queue>
#include "fsfw/cfdp/handler/FaultHandlerBase.h"
namespace cfdp {
class FaultHandlerMock : public FaultHandlerBase {
public:
struct FaultInfo {
size_t callCount = 0;
std::queue<cfdp::ConditionCode> condCodes;
};
void noticeOfSuspensionCb(ConditionCode code) override;
void noticeOfCancellationCb(ConditionCode code) override;
void abandonCb(ConditionCode code) override;
void ignoreCb(ConditionCode code) override;
FaultInfo& getFhInfo(FaultHandlerCodes fhCode);
[[nodiscard]] bool faultCbWasCalled() const;
void reset();
private:
std::map<cfdp::FaultHandlerCodes, FaultInfo> fhInfoMap = {
std::pair{cfdp::FaultHandlerCodes::IGNORE_ERROR, FaultInfo()},
std::pair{cfdp::FaultHandlerCodes::NOTICE_OF_CANCELLATION, FaultInfo()},
std::pair{cfdp::FaultHandlerCodes::NOTICE_OF_SUSPENSION, FaultInfo()},
std::pair{cfdp::FaultHandlerCodes::ABANDON_TRANSACTION, FaultInfo()}};
};
} // namespace cfdp
#endif // FSFW_TESTS_FAULTHANDLERMOCK_H