unit-test: Test need_to_introspect function

Testing: Verified 100% code coverage of processing.cpp

Change-Id: I5ebdebe3fdcecbf250a23754f8b5c7db81bfaaa3
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
diff --git a/src/test/Makefile.am.include b/src/test/Makefile.am.include
index a698753..23ba45a 100644
--- a/src/test/Makefile.am.include
+++ b/src/test/Makefile.am.include
@@ -1,4 +1,8 @@
 src_test_well_known_SOURCES = %reldir%/well_known.cpp src/processing.cpp
 
+src_test_need_to_introspect_SOURCES = %reldir%/need_to_introspect.cpp \
+	src/processing.cpp
+
 check_PROGRAMS += \
-	%reldir%/well_known
+	%reldir%/well_known \
+	%reldir%/need_to_introspect
diff --git a/src/test/need_to_introspect.cpp b/src/test/need_to_introspect.cpp
new file mode 100644
index 0000000..6912619
--- /dev/null
+++ b/src/test/need_to_introspect.cpp
@@ -0,0 +1,43 @@
+#include "src/processing.hpp"
+
+#include <gtest/gtest.h>
+
+// Verify if name is empty, false is returned
+TEST(NeedToIntrospect, PassEmptyName)
+{
+    WhiteBlackList whiteList;
+    WhiteBlackList blackList;
+    std::string process_name;
+
+    EXPECT_FALSE(needToIntrospect(process_name, whiteList, blackList));
+}
+
+// Verify if name is on whitelist, true is returned
+TEST(NeedToIntrospect, ValidWhiteListName)
+{
+    WhiteBlackList whiteList = {"xyz.openbmc_project"};
+    WhiteBlackList blackList;
+    std::string process_name = "xyz.openbmc_project.State.Host";
+
+    EXPECT_TRUE(needToIntrospect(process_name, whiteList, blackList));
+}
+
+// Verify if name is on blacklist, false is returned
+TEST(NeedToIntrospect, ValidBlackListName)
+{
+    WhiteBlackList whiteList;
+    WhiteBlackList blackList = {"xyz.openbmc_project.State.Host"};
+    std::string process_name = "xyz.openbmc_project.State.Host";
+
+    EXPECT_FALSE(needToIntrospect(process_name, whiteList, blackList));
+}
+
+// Verify if name is on whitelist and blacklist, false is returned
+TEST(NeedToIntrospect, ValidWhiteAndBlackListName)
+{
+    WhiteBlackList whiteList = {"xyz.openbmc_project"};
+    WhiteBlackList blackList = {"xyz.openbmc_project.State.Host"};
+    std::string process_name = "xyz.openbmc_project.State.Host";
+
+    EXPECT_FALSE(needToIntrospect(process_name, whiteList, blackList));
+}