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
- xcb-proto
- xutils-dev
- libgtest-dev
cache:
directories:

View File

@ -28,7 +28,7 @@ if(result)
endif()
# 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
${CMAKE_BINARY_DIR}/googletest-build
EXCLUDE_FROM_ALL)
@ -51,8 +51,8 @@ function(unit_test file tests)
set(name "unit_test.${testname}")
add_executable(${name} unit_tests/${file}.cpp ${sources})
# Link against googletest
target_link_libraries(${name} gtest_main)
# Link against gmock (this automatically links against gtest)
target_link_libraries(${name} gmock_main)
add_test(NAME ${name} COMMAND ${name})

View File

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