hwmon module unit-tests -- first one
This patchset just starts the process of adding unit-tests
to the hwmon module.
Change-Id: I569aa97658b0ff56634ddf1a599fedb4caa95abe
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/test/.gitignore b/test/.gitignore
new file mode 100644
index 0000000..70cb196
--- /dev/null
+++ b/test/.gitignore
@@ -0,0 +1 @@
+test-suite.log
diff --git a/test/Makefile.am b/test/Makefile.am
new file mode 100644
index 0000000..7f302ca
--- /dev/null
+++ b/test/Makefile.am
@@ -0,0 +1,20 @@
+AM_CPPFLAGS = -I$(top_srcdir)/ $(GTEST_CFLAGS) $(GMOCK_CFLAGS)
+AM_CXXFLAGS = $(PTHREAD_CFLAGS) \
+ $(GTEST_CFLAGS) \
+ $(GMOCK_CFLAGS) \
+ $(SDBUSPLUS_CFLAGS) \
+ $(PHOSPHOR_DBUS_INTERFACES_CFLAGS)
+AM_LDFLAGS = $(GTEST_LIBS) \
+ $(PTHREAD_LIBS) \
+ $(GMOCK_LIBS) \
+ $(OESDK_TESTCASE_FLAGS) \
+ $(SDBUSPLUS_LIBS) \
+ $(PHOSPHOR_DBUS_INTERFACES_LIBS)
+
+# Run all 'check' test programs
+check_PROGRAMS = hwmon_unittest
+TESTS = $(check_PROGRAMS)
+
+hwmon_unittest_SOURCES = hwmon_unittest.cpp
+hwmon_unittest_LDADD = $(top_builddir)/hwmon.o
+
diff --git a/test/hwmon_unittest.cpp b/test/hwmon_unittest.cpp
new file mode 100644
index 0000000..035d098
--- /dev/null
+++ b/test/hwmon_unittest.cpp
@@ -0,0 +1,12 @@
+#include "hwmon.hpp"
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+TEST(HwmonTest, InvalidType) {
+
+ hwmon::Attributes attrs;
+ EXPECT_FALSE(hwmon::getAttributes("invalid", attrs));
+
+}
+