summaryrefslogtreecommitdiffstats
path: root/src/test/need_to_introspect.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/need_to_introspect.cpp')
-rw-r--r--src/test/need_to_introspect.cpp43
1 files changed, 43 insertions, 0 deletions
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));
+}
OpenPOWER on IntegriCloud