Skip to content

Commit

Permalink
Update testing CMake for new GoogleTest
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Carroll <michael@openrobotics.org>
  • Loading branch information
mjcarroll committed May 31, 2022
1 parent 0d09710 commit 17b3520
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/graph/Edge_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class EdgeTestFixture : public testing::Test
// The list of edges we want to test.
using EdgeTypes = ::testing::Types<DirectedEdge<int>,
UndirectedEdge<int>>;
TYPED_TEST_CASE(EdgeTestFixture, EdgeTypes);
TYPED_TEST_SUITE(EdgeTestFixture, EdgeTypes, );

/////////////////////////////////////////////////
TYPED_TEST(EdgeTestFixture, Accessors)
Expand Down
2 changes: 1 addition & 1 deletion src/graph/GraphAlgorithms_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class GraphTestFixture : public testing::Test
// The list of graphs we want to test.
using GraphTypes = ::testing::Types<DirectedGraph<int, double>,
UndirectedGraph<int, double>>;
TYPED_TEST_CASE(GraphTestFixture, GraphTypes);
TYPED_TEST_SUITE(GraphTestFixture, GraphTypes, );

/////////////////////////////////////////////////
TYPED_TEST(GraphTestFixture, BreadthFirstSort)
Expand Down
2 changes: 1 addition & 1 deletion src/graph/Graph_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class MockEdgesFullUndirectedGraph : public UndirectedGraph<V, E>
// The list of graphs we want to test.
using GraphTypes = ::testing::Types<DirectedGraph<int, double>,
UndirectedGraph<int, double>>;
TYPED_TEST_CASE(GraphTestFixture, GraphTypes);
TYPED_TEST_SUITE(GraphTestFixture, GraphTypes, );

/////////////////////////////////////////////////
TYPED_TEST(GraphTestFixture, UniformInitialization)
Expand Down
15 changes: 8 additions & 7 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
configure_file (test_config.h.in ${PROJECT_BINARY_DIR}/test_config.h)
include_directories (
${PROJECT_SOURCE_DIR}/test/gtest/include
${PROJECT_SOURCE_DIR}/test/gtest
${PROJECT_SOURCE_DIR}/test
${CMAKE_BINARY_DIR}/include
${PROJECT_BINARY_DIR}/include
)

configure_file (test_config.h.in ${PROJECT_BINARY_DIR}/test_config.h)

# Build gtest
add_library(gtest STATIC gtest/src/gtest-all.cc)
add_library(gtest_main STATIC gtest/src/gtest_main.cc)
target_include_directories(gtest
SYSTEM PUBLIC
${PROJECT_SOURCE_DIR}/test/gtest/include
${PROJECT_SOURCE_DIR}/test/gtest
)

target_link_libraries(gtest_main gtest)
set_property(TARGET gtest_main PROPERTY CXX_STANDARD ${c++standard})
set_property(TARGET gtest PROPERTY CXX_STANDARD ${c++standard})
Expand All @@ -18,7 +20,6 @@ set(GTEST_MAIN_LIBRARY "${PROJECT_BINARY_DIR}/test/libgtest_main.a")

execute_process(COMMAND cmake -E remove_directory ${CMAKE_BINARY_DIR}/test_results)
execute_process(COMMAND cmake -E make_directory ${CMAKE_BINARY_DIR}/test_results)
include_directories(${GTEST_INCLUDE_DIRS})

#============================================================================
# Do a fake install of ign-math in order to test the examples.
Expand Down

0 comments on commit 17b3520

Please sign in to comment.