hwmonio:: Add Interface base class and tests
Enable injecting hwmonio::HwmonIO mocks for testing.
Tested: Ran on quanta-q71l and saw all sensors exported to dbus as
expected with the expected values.
Change-Id: I35912bf2a733932d9e1e774ff53b0114ae16560b
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/test/hwmonio_mock.hpp b/test/hwmonio_mock.hpp
new file mode 100644
index 0000000..4ad944c
--- /dev/null
+++ b/test/hwmonio_mock.hpp
@@ -0,0 +1,32 @@
+#pragma once
+
+#include <gmock/gmock.h>
+
+#include "hwmonio.hpp"
+
+namespace hwmonio {
+
+class HwmonIOMock : public HwmonIOInterface
+{
+ public:
+ virtual ~HwmonIOMock(){};
+
+ MOCK_CONST_METHOD5(read, int64_t(const std::string&,
+ const std::string&,
+ const std::string&,
+ size_t,
+ std::chrono::milliseconds));
+
+ MOCK_CONST_METHOD6(write, void(uint32_t,
+ const std::string&,
+ const std::string&,
+ const std::string&,
+ size_t,
+ std::chrono::milliseconds));
+
+ MOCK_CONST_METHOD0(path, std::string());
+};
+
+} // namespace hwmonio
+
+// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4