add new VerificationReporterIF
This commit is contained in:
30
unittests/mocks/PusServiceBaseMock.cpp
Normal file
30
unittests/mocks/PusServiceBaseMock.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
#include "PusServiceBaseMock.h"
|
||||
|
||||
ReturnValue_t PsbMock::handleRequest(uint8_t subservice) {
|
||||
handleRequestCallCnt++;
|
||||
subserviceQueue.push(subservice);
|
||||
if (handleReqFailPair.first) {
|
||||
handleReqFailPair.first = false;
|
||||
return handleReqFailPair.second;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t PsbMock::performService() {
|
||||
performServiceCallCnt++;
|
||||
if (performServiceFailPair.first) {
|
||||
performServiceFailPair.first = false;
|
||||
return performServiceFailPair.second;
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
void PsbMock::reset() {
|
||||
handleRequestCallCnt = 0;
|
||||
performServiceCallCnt = 0;
|
||||
std::queue<uint8_t>().swap(subserviceQueue);
|
||||
}
|
||||
void PsbMock::makeNextHandleReqCallFail(ReturnValue_t retval) {
|
||||
handleReqFailPair.first = true;
|
||||
handleReqFailPair.second = retval;
|
||||
}
|
23
unittests/mocks/PusServiceBaseMock.h
Normal file
23
unittests/mocks/PusServiceBaseMock.h
Normal file
@ -0,0 +1,23 @@
|
||||
#ifndef FSFW_TESTS_PUSSERVICEBASEMOCK_H
|
||||
#define FSFW_TESTS_PUSSERVICEBASEMOCK_H
|
||||
|
||||
#include <queue>
|
||||
|
||||
#include "fsfw/tmtcservices/PusServiceBase.h"
|
||||
|
||||
class PsbMock : public PusServiceBase {
|
||||
public:
|
||||
unsigned int handleRequestCallCnt = 0;
|
||||
std::queue<uint8_t> subserviceQueue;
|
||||
unsigned int performServiceCallCnt = 0;
|
||||
|
||||
std::pair<bool, ReturnValue_t> handleReqFailPair;
|
||||
std::pair<bool, ReturnValue_t> performServiceFailPair;
|
||||
ReturnValue_t handleRequest(uint8_t subservice) override;
|
||||
ReturnValue_t performService() override;
|
||||
|
||||
void makeNextHandleReqCallFail(ReturnValue_t retval);
|
||||
void reset();
|
||||
};
|
||||
|
||||
#endif // FSFW_TESTS_PUSSERVICEBASEMOCK_H
|
Reference in New Issue
Block a user