Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GoogleTest to latest version #435

Merged
merged 8 commits into from
Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ find_package(gz-cmake3 REQUIRED)
#============================================================================
# Configure the project
#============================================================================
set (c++standard 17)
set (CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

gz_configure_project(
REPLACE_IGNITION_INCLUDE_PATH gz/math
VERSION_SUFFIX pre1)
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
gz_get_libsources_and_unittests(sources gtest_sources)

# Create the library target
gz_create_core_library(SOURCES ${sources} CXX_STANDARD ${c++standard})
gz_create_core_library(SOURCES ${sources} CXX_STANDARD ${CMAKE_CXX_STANDARD})

target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC
Expand Down
7 changes: 0 additions & 7 deletions src/Color_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,3 @@ TEST(Color, HSV)
EXPECT_NEAR(clr.B(), 0.3f, 1e-3);
EXPECT_NEAR(clr.A(), 1.0, 1e-3);
}

/////////////////////////////////////////////////
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
6 changes: 0 additions & 6 deletions src/MovingWindowFilter_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,3 @@ TEST(MovingWindowFilterTest, FilterSomething)
3.0*static_cast<double>(i));
EXPECT_EQ(vectorMWF.Value(), vsum / 20.0);
}

int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
8 changes: 0 additions & 8 deletions src/SemanticVersion_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,3 @@ TEST(SemVerTest, Constructor)
EXPECT_TRUE(a.Prerelease().empty());
EXPECT_TRUE(a.Build().empty());
}

/////////////////////////////////////////////////
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

7 changes: 0 additions & 7 deletions src/Temperature_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,3 @@ TEST(TemperatureTest, Negative)
Temperature temp5 = 2.0 / temp3;
EXPECT_NEAR(temp5.Kelvin(), 2.0, 1e-6);
}

/////////////////////////////////////////////////
int main(int argc, char **argv)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
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 @@ -33,7 +33,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
1 change: 0 additions & 1 deletion src/ruby/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ if (RUBY_FOUND)
gz-utils${GZ_UTILS_VER}::gz-utils${GZ_UTILS_VER}
gz-math${PROJECT_VERSION_MAJOR}
)
target_compile_features(${SWIG_RB_LIB} PUBLIC ${IGN_CXX_${c++standard}_FEATURES})

set_target_properties(${SWIG_RB_LIB}
PROPERTIES
Expand Down
24 changes: 5 additions & 19 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
configure_file (test_config.hh.in
${PROJECT_BINARY_DIR}/include/test_config.hh
)
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_link_libraries(gtest_main gtest)
set_property(TARGET gtest_main PROPERTY CXX_STANDARD ${c++standard})
set_property(TARGET gtest PROPERTY CXX_STANDARD ${c++standard})
set(GTEST_LIBRARY "${PROJECT_BINARY_DIR}/test/libgtest.a")
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 All @@ -41,6 +26,7 @@ ExternalProject_Add(
"-DCMAKE_INSTALL_PREFIX=${FAKE_INSTALL_PREFIX}"
)

add_subdirectory(gtest_vendor)
add_subdirectory(integration)
add_subdirectory(performance)
add_subdirectory(regression)
Loading