From 2fa4fd61d0ee5fb626e9fb9d70a98a08109d2438 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Sun, 5 Jun 2022 12:54:13 +0200 Subject: [PATCH] device fdir mock --- .../unit/devicehandler/CMakeLists.txt | 8 ++++++++ .../unit/devicehandler/DeviceFdirMock.cpp | 18 ++++++++++++++++++ .../unit/devicehandler/DeviceFdirMock.h | 18 ++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 tests/src/fsfw_tests/unit/devicehandler/CMakeLists.txt create mode 100644 tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.cpp create mode 100644 tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.h diff --git a/tests/src/fsfw_tests/unit/devicehandler/CMakeLists.txt b/tests/src/fsfw_tests/unit/devicehandler/CMakeLists.txt new file mode 100644 index 000000000..7ad5d3169 --- /dev/null +++ b/tests/src/fsfw_tests/unit/devicehandler/CMakeLists.txt @@ -0,0 +1,8 @@ +target_sources(${FSFW_TEST_TGT} PRIVATE + CookieIFMock.cpp + ComIFMock.cpp + DeviceHandlerCommander.cpp + DeviceHandlerMock.cpp + DeviceFdirMock.cpp + TestDeviceHandlerBase.cpp +) diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.cpp b/tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.cpp new file mode 100644 index 000000000..dfef7cd3e --- /dev/null +++ b/tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.cpp @@ -0,0 +1,18 @@ +#include "DeviceFdirMock.h" + +#include + +DeviceFdirMock::DeviceFdirMock(object_id_t owner, object_id_t parent) + : DeviceHandlerFailureIsolation(owner, parent) {} + +DeviceFdirMock::~DeviceFdirMock() {} + +uint32_t DeviceFdirMock::getMissedReplyCount() { + ParameterWrapper parameterWrapper; + this->getParameter(MISSED_REPLY_DOMAIN_ID, + static_cast(FaultCounter::ParameterIds::FAULT_COUNT), + ¶meterWrapper, nullptr, 0); + uint32_t missedReplyCount = 0; + parameterWrapper.getElement(&missedReplyCount); + return missedReplyCount; +} diff --git a/tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.h b/tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.h new file mode 100644 index 000000000..b314fc989 --- /dev/null +++ b/tests/src/fsfw_tests/unit/devicehandler/DeviceFdirMock.h @@ -0,0 +1,18 @@ +#ifndef TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEFDIRMOCK_H_ +#define TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEFDIRMOCK_H_ + +#include "fsfw/devicehandlers/DeviceHandlerFailureIsolation.h" + +class DeviceFdirMock : public DeviceHandlerFailureIsolation { + public: + DeviceFdirMock(object_id_t owner, object_id_t parent); + virtual ~DeviceFdirMock(); + + uint32_t getMissedReplyCount(); + + private: + static const uint8_t STRANGE_REPLY_DOMAIN_ID = 0xF0; + static const uint8_t MISSED_REPLY_DOMAIN_ID = 0xF1; +}; + +#endif /* TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEFDIRMOCK_H_ */