test: add gpiohandle mock impl
Add gpio handle mock implementation for use in testing.
Change-Id: I0fb2d1af4739ad700f62a4e7cbbe62db528bb93e
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/test/gpio.cpp b/test/gpio.cpp
new file mode 100644
index 0000000..cf01a0a
--- /dev/null
+++ b/test/gpio.cpp
@@ -0,0 +1,18 @@
+#include "gpio_mock.hpp"
+
+#include <memory>
+#include <string>
+
+// Set this before each test that hits a call to getEnv().
+GpioHandleInterface* gpioIntf;
+
+namespace gpio
+{
+
+std::unique_ptr<gpioplus::HandleInterface>
+ BuildGpioHandle(const std::string& gpiochip, const std::string& line)
+{
+ return (gpioIntf) ? gpioIntf->build(gpiochip, line) : nullptr;
+}
+
+} // namespace gpio