#pragma once #include "interfaces/sensor.hpp" #include "interfaces/threshold.hpp" #include "utils/conv_container.hpp" #include #include class ThresholdMock : public interfaces::Threshold, public std::enable_shared_from_this { public: MOCK_METHOD(void, initialize, (), (override)); MOCK_METHOD(LabeledThresholdParam, getThresholdParam, (), (const, override)); MOCK_METHOD(void, updateSensors, (Sensors newSensors), (override)); static std::vector> makeThresholds(const LabeledTriggerThresholdParams& params) { using namespace testing; std::vector>> result; if (std::holds_alternative>( params)) { auto unpackedParams = std::get>(params); for (const auto& param : unpackedParams) { auto& thresholdMock = result.emplace_back( std::make_shared>()); ON_CALL(*thresholdMock, getThresholdParam()) .WillByDefault(Return(param)); } } else { auto unpackedParams = std::get>(params); for (const auto& param : unpackedParams) { auto& thresholdMock = result.emplace_back( std::make_shared>()); ON_CALL(*thresholdMock, getThresholdParam()) .WillByDefault(Return(param)); } if (unpackedParams.empty()) { auto& thresholdMock = result.emplace_back( std::make_shared>()); ON_CALL(*thresholdMock, getThresholdParam()) .WillByDefault(Return(std::monostate{})); } } return utils::convContainer>( result); } };