summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2018-04-17 17:51:56 -0700
committerPatrick Venture <venture@google.com>2018-04-24 19:58:18 +0000
commit609fe98205fe8f4bd0dc6b9fca66877e2edf186d (patch)
treebd16de833ea75277aca274c86a620c3c3d3df2ce /test
parentc635e8609f5246224dfba7db57991de0b1c5327f (diff)
downloadphosphor-hwmon-609fe98205fe8f4bd0dc6b9fca66877e2edf186d.tar.gz
phosphor-hwmon-609fe98205fe8f4bd0dc6b9fca66877e2edf186d.zip
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>
Diffstat (limited to 'test')
-rw-r--r--test/.gitignore1
-rw-r--r--test/Makefile.am20
-rw-r--r--test/hwmon_unittest.cpp12
3 files changed, 33 insertions, 0 deletions
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));
+
+}
+
OpenPOWER on IntegriCloud