From 170c18762d89a1c0e77aeb073e3a8b0c97e2d658 Mon Sep 17 00:00:00 2001 From: Patricia Aas Date: Fri, 27 Nov 2020 17:48:38 +0100 Subject: [PATCH] Add gtest --- pacman/CMakeLists.txt | 3 ++- pacman/conanfile.py | 1 + pacman/test/CMakeLists.txt | 11 +++++++++++ pacman/test/tests.cpp | 6 ++++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 pacman/test/CMakeLists.txt create mode 100644 pacman/test/tests.cpp diff --git a/pacman/CMakeLists.txt b/pacman/CMakeLists.txt index 130b119..a9289c2 100644 --- a/pacman/CMakeLists.txt +++ b/pacman/CMakeLists.txt @@ -1 +1,2 @@ -add_subdirectory(src) \ No newline at end of file +add_subdirectory(src) +add_subdirectory(test) \ No newline at end of file diff --git a/pacman/conanfile.py b/pacman/conanfile.py index 6c22698..ec45826 100644 --- a/pacman/conanfile.py +++ b/pacman/conanfile.py @@ -9,6 +9,7 @@ class ConanDependencies(ConanFile): } def requirements(self): + self.requires("gtest/1.10.0") self.requires("sdl2/2.0.9@bincrafters/stable") self.requires("sdl2_image/2.0.4@bincrafters/stable") diff --git a/pacman/test/CMakeLists.txt b/pacman/test/CMakeLists.txt new file mode 100644 index 0000000..f7a8b2b --- /dev/null +++ b/pacman/test/CMakeLists.txt @@ -0,0 +1,11 @@ +enable_testing() +find_package(GTest REQUIRED) + +include(GoogleTest) + +add_executable(tests tests.cpp) +target_link_libraries(tests GTest::GTest) + +gtest_add_tests(TARGET tests TEST_PREFIX old_pacman:) +gtest_discover_tests(tests TEST_PREFIX new_pacman:) +add_test(NAME monolithic COMMAND tests) \ No newline at end of file diff --git a/pacman/test/tests.cpp b/pacman/test/tests.cpp new file mode 100644 index 0000000..1da8654 --- /dev/null +++ b/pacman/test/tests.cpp @@ -0,0 +1,6 @@ +#include + +int main(int argc, char* argv[]) { + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} \ No newline at end of file