add gtest files 44/278244/1
authorSooChan Lim <sc1.lim@samsung.com>
Thu, 7 Jul 2022 23:08:36 +0000 (08:08 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 18 Jul 2022 05:59:18 +0000 (14:59 +0900)
Change-Id: I2d2c87aee0a1c842467d04d907f249ce4bd6b57b

packaging/libds-tizen.spec
tests/tc_main.cpp [new file with mode: 0644]
tests/tc_main.h [new file with mode: 0644]

index fe34941..0ac145b 100644 (file)
@@ -27,6 +27,7 @@ BuildRequires:  pkgconfig(tizen-dpms-client)
 BuildRequires:  pkgconfig(cynara-client)
 BuildRequires:  pkgconfig(cynara-session)
 BuildRequires:  pkgconfig(libsmack)
+BuildRequires:  pkgconfig(gmock)
 
 %description
 Wayland Compositor Library for Tizen
diff --git a/tests/tc_main.cpp b/tests/tc_main.cpp
new file mode 100644 (file)
index 0000000..5e99a34
--- /dev/null
@@ -0,0 +1,26 @@
+#include "gmock/gmock.h"
+
+int
+main(int argc, char **argv)
+{
+    auto AllTestSuccess = false;
+
+    try {
+        ::testing::InitGoogleMock(&argc, argv);
+        ::testing::FLAGS_gtest_death_test_style = "fast";
+    } catch (...) {
+        std::cout << "error while trying to init google tests.\n";
+        exit(EXIT_FAILURE);
+    }
+
+    try {
+        AllTestSuccess = RUN_ALL_TESTS() == 0 ? true : false;
+    } catch (const ::testing::internal::GoogleTestFailureException &e) {
+        AllTestSuccess = false;
+        std::cout << "GoogleTestFailureException was thrown:" << e.what()
+                  << std::endl;
+        std::cout << "\n";
+    }
+
+    return AllTestSuccess;
+}
diff --git a/tests/tc_main.h b/tests/tc_main.h
new file mode 100644 (file)
index 0000000..41e630a
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef TC_MAIN_H
+#define TC_MAIN_H
+
+#include <iostream>
+#include <gmock/gmock.h>
+
+using ::testing::Bool;
+using ::testing::Combine;
+using ::testing::TestWithParam;
+using ::testing::Values;
+
+#endif