tests: Use local gtest headers

This makes sure the headers and the compiled gtest library are
compatible
This commit is contained in:
patrick96 2018-04-08 17:53:13 +02:00 committed by Patrick Ziegler
parent fa99be63a0
commit 0e5584920b
3 changed files with 5 additions and 5 deletions

View File

@ -65,7 +65,6 @@ addons:
- python-xcbgen - python-xcbgen
- xcb-proto - xcb-proto
- xutils-dev - xutils-dev
- libgtest-dev
cache: cache:
directories: directories:

View File

@ -28,7 +28,7 @@ if(result)
endif() endif()
# Add googletest directly to our build. This defines # Add googletest directly to our build. This defines
# the gtest and gtest_main targets. # the gtest, gtest_main, gmock and gmock_main targets.
add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src
${CMAKE_BINARY_DIR}/googletest-build ${CMAKE_BINARY_DIR}/googletest-build
EXCLUDE_FROM_ALL) EXCLUDE_FROM_ALL)
@ -51,8 +51,8 @@ function(unit_test file tests)
set(name "unit_test.${testname}") set(name "unit_test.${testname}")
add_executable(${name} unit_tests/${file}.cpp ${sources}) add_executable(${name} unit_tests/${file}.cpp ${sources})
# Link against googletest # Link against gmock (this automatically links against gtest)
target_link_libraries(${name} gtest_main) target_link_libraries(${name} gmock_main)
add_test(NAME ${name} COMMAND ${name}) add_test(NAME ${name} COMMAND ${name})

View File

@ -9,7 +9,8 @@
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <gtest/gtest.h>
#include "gtest/gtest.h"
#define expect(...) \ #define expect(...) \
(void)((__VA_ARGS__) || (expect_fail__(#__VA_ARGS__, __FILE__, __LINE__), 0)) (void)((__VA_ARGS__) || (expect_fail__(#__VA_ARGS__, __FILE__, __LINE__), 0))