xref: /openbmc/pldm/common/test/mocked_utils.hpp (revision 2746fb48)
1 #include "common/utils.hpp"
2 
3 #include <gmock/gmock.h>
4 #include <gtest/gtest.h>
5 
6 namespace pldm
7 {
8 namespace utils
9 {
10 
11 /** @brief helper function for parameter matching
12  *  @param[in] lhs - left-hand side value
13  *  @param[in] rhs - right-hand side value
14  *  @return true if it matches
15  */
16 inline bool operator==(const DBusMapping& lhs, const DBusMapping& rhs)
17 {
18     return lhs.objectPath == rhs.objectPath && lhs.interface == rhs.interface &&
19            lhs.propertyName == rhs.propertyName &&
20            lhs.propertyType == rhs.propertyType;
21 }
22 
23 } // namespace utils
24 } // namespace pldm
25 
26 class MockdBusHandler : public pldm::utils::DBusHandler
27 {
28   public:
29     MOCK_METHOD(std::string, getService, (const char*, const char*),
30                 (const override));
31 
32     MOCK_METHOD(void, setDbusProperty,
33                 (const pldm::utils::DBusMapping&,
34                  const pldm::utils::PropertyValue&),
35                 (const override));
36 
37     MOCK_METHOD(pldm::utils::PropertyValue, getDbusPropertyVariant,
38                 (const char*, const char*, const char*), (const override));
39 };
40