From f7790557494db83dc62a50b285bed2bce9775a3e Mon Sep 17 00:00:00 2001 From: SooChan Lim Date: Fri, 8 Jul 2022 08:08:36 +0900 Subject: [PATCH] add gtest files Change-Id: I2d2c87aee0a1c842467d04d907f249ce4bd6b57b --- packaging/libds-tizen.spec | 1 + tests/tc_main.cpp | 26 ++++++++++++++++++++++++++ tests/tc_main.h | 12 ++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 tests/tc_main.cpp create mode 100644 tests/tc_main.h diff --git a/packaging/libds-tizen.spec b/packaging/libds-tizen.spec index fe34941..0ac145b 100644 --- a/packaging/libds-tizen.spec +++ b/packaging/libds-tizen.spec @@ -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 index 0000000..5e99a34 --- /dev/null +++ b/tests/tc_main.cpp @@ -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 index 0000000..41e630a --- /dev/null +++ b/tests/tc_main.h @@ -0,0 +1,12 @@ +#ifndef TC_MAIN_H +#define TC_MAIN_H + +#include +#include + +using ::testing::Bool; +using ::testing::Combine; +using ::testing::TestWithParam; +using ::testing::Values; + +#endif -- 2.7.4