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

Fix issues with Gtest and MinGW #1265

Merged
merged 5 commits into from
Feb 15, 2019
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
4 changes: 2 additions & 2 deletions test/googletest/CMakeLists.txt.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ project(googletest-download NONE)

include(ExternalProject)
ExternalProject_Add(googletest
URL https://github.com/google/googletest/archive/release-1.8.0.zip
URL_HASH SHA1=667f873ab7a4d246062565fad32fb6d8e203ee73
URL https://github.com/google/googletest/archive/release-1.8.1.zip
URL_HASH SHA1=7b41ea3682937069e3ce32cb06619fead505795e
DOWNLOAD_NO_PROGRESS ON
SOURCE_DIR "${CMAKE_BINARY_DIR}/googletest-src"
BINARY_DIR "${CMAKE_BINARY_DIR}/googletest-build"
Expand Down
26 changes: 12 additions & 14 deletions test/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ option(USE_EXTERNAL_GTEST "Compile against external GTest" OFF)
if (USE_EXTERNAL_GTEST)

message(STATUS "Using external GTest")
find_package(GTest 1.8.0)
find_package(GTest 1.8.1 CONFIG REQUIRED)

else (USE_EXTERNAL_GTEST)

Expand Down Expand Up @@ -42,22 +42,20 @@ endif()
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
# Add googletest directly to our build. This defines
# the gtest and gtest_main targets.
option(INSTALL_GTEST "Enable installation of googletest" OFF)
add_subdirectory(${CMAKE_BINARY_DIR}/googletest-src
${CMAKE_BINARY_DIR}/googletest-build
EXCLUDE_FROM_ALL)
# The gtest/gtest_main targets carry header search path
# dependencies automatically when using CMake 2.8.11 or
# later. Otherwise we have to add them here ourselves.
if (CMAKE_VERSION VERSION_LESS 2.8.11)
include_directories("${gtest_SOURCE_DIR}/include")
endif()

# FIXME: Deal with our old-school CMakeLists.txt behaving badly
set(CMAKE_C_FLAGS "${_save_c_flags}")
set(CMAKE_CXX_FLAGS "${_save_cxx_flags}")
unset(_save_c_flags)
unset(_save_cxx_flags)

# Provide the same target name as find_package(GTest)
add_library(GTest::gtest ALIAS gtest)

endif(USE_EXTERNAL_GTEST)

#
Expand All @@ -75,31 +73,31 @@ add_executable(proj_pj_transform_test
main.cpp
pj_transform_test.cpp)
target_link_libraries(proj_pj_transform_test
gtest
GTest::gtest
${PROJ_LIBRARIES})
add_test(NAME proj_pj_transform_test COMMAND proj_pj_transform_test)

add_executable(proj_errno_string_test
main.cpp
proj_errno_string_test.cpp)
target_link_libraries(proj_errno_string_test
gtest
GTest::gtest
${PROJ_LIBRARIES})
add_test(NAME proj_errno_string_test COMMAND proj_errno_string_test)

add_executable(proj_angular_io_test
main.cpp
proj_angular_io_test.cpp)
target_link_libraries(proj_angular_io_test
gtest
GTest::gtest
${PROJ_LIBRARIES})
add_test(NAME proj_angular_io_test COMMAND proj_angular_io_test)

add_executable(proj_context_test
main.cpp
proj_context_test.cpp)
target_link_libraries(proj_context_test
gtest
GTest::gtest
${PROJ_LIBRARIES})
add_test(NAME proj_context_test COMMAND proj_context_test)

Expand All @@ -110,7 +108,7 @@ add_executable(pj_phi2_test
main.cpp
pj_phi2_test.cpp)
target_link_libraries(pj_phi2_test
gtest
GTest::gtest
${PROJ_LIBRARIES})
add_test(NAME pj_phi2_test COMMAND pj_phi2_test)
endif()
Expand All @@ -127,7 +125,7 @@ add_executable(proj_test_cpp_api
test_factory.cpp
test_c_api.cpp)
target_link_libraries(proj_test_cpp_api
gtest
GTest::gtest
${PROJ_LIBRARIES}
${SQLITE3_LIBRARY})
add_test(NAME proj_test_cpp_api COMMAND proj_test_cpp_api)
Expand All @@ -136,6 +134,6 @@ add_executable(gie_self_tests
main.cpp
gie_self_tests.cpp)
target_link_libraries(gie_self_tests
gtest
GTest::gtest
${PROJ_LIBRARIES})
add_test(NAME gie_self_tests COMMAND gie_self_tests)
4 changes: 2 additions & 2 deletions test/unit/gie_self_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ TEST(gie, cart_selftest) {
n = proj_trans_generic(P, PJ_FWD, &(obs[0].lpz.lam), sz, 2,
&(obs[0].lpz.phi), sz, 2, &(obs[0].lpz.z), sz, 2, 0,
sz, 0);
ASSERT_EQ(n, 2);
ASSERT_EQ(n, 2U);

ASSERT_EQ(a.lpz.lam, obs[0].lpz.lam);
ASSERT_EQ(a.lpz.phi, obs[0].lpz.phi);
Expand All @@ -197,7 +197,7 @@ TEST(gie, cart_selftest) {
t = 33;
n = proj_trans_generic(P, PJ_FWD, &(obs[0].lpz.lam), sz, 2,
&(obs[0].lpz.phi), sz, 2, &h, 0, 1, &t, 0, 1);
ASSERT_EQ(n, 2);
ASSERT_EQ(n, 2U);

ASSERT_EQ(a.lpz.lam, obs[0].lpz.lam);
ASSERT_EQ(a.lpz.phi, obs[0].lpz.phi);
Expand Down
4 changes: 2 additions & 2 deletions test/unit/pj_transform_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ TEST(proj_api_h, pj_set_searchpath) {
pj_set_searchpath(1, &path);
{
auto info = proj_info();
EXPECT_EQ(info.path_count, 1);
EXPECT_EQ(info.path_count, 1U);
ASSERT_NE(info.paths, nullptr);
ASSERT_NE(info.paths[0], nullptr);
EXPECT_EQ(std::string(info.paths[0]), path);
Expand All @@ -599,7 +599,7 @@ TEST(proj_api_h, pj_set_searchpath) {
pj_set_searchpath(0, nullptr);
{
auto info = proj_info();
EXPECT_EQ(info.path_count, 0);
EXPECT_EQ(info.path_count, 0U);
EXPECT_EQ(info.paths, nullptr);
}
}
Expand Down
8 changes: 4 additions & 4 deletions test/unit/test_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ TEST(common, identifiedobject) {
properties.set(IdentifiedObject::DEPRECATED_KEY, true);
auto obj = OperationParameter::create(properties);
EXPECT_EQ(*(obj->name()->description()), "name");
ASSERT_EQ(obj->identifiers().size(), 1);
ASSERT_EQ(obj->identifiers().size(), 1U);
EXPECT_EQ(obj->identifiers()[0]->code(), "identifier_code");
ASSERT_EQ(obj->aliases().size(), 1);
ASSERT_EQ(obj->aliases().size(), 1U);
EXPECT_EQ(obj->aliases()[0]->toString(), "alias");
EXPECT_EQ(obj->remarks(), "remarks");
EXPECT_TRUE(obj->isDeprecated());
Expand Down Expand Up @@ -141,7 +141,7 @@ TEST(common, identifiedobject_identifier_array_of_identifier) {
array->add(Identifier::create("identifier_code2"));
properties.set(IdentifiedObject::IDENTIFIERS_KEY, array);
auto obj = OperationParameter::create(properties);
ASSERT_EQ(obj->identifiers().size(), 2);
ASSERT_EQ(obj->identifiers().size(), 2U);
EXPECT_EQ(obj->identifiers()[0]->code(), "identifier_code1");
EXPECT_EQ(obj->identifiers()[1]->code(), "identifier_code2");
}
Expand All @@ -164,7 +164,7 @@ TEST(common, identifiedobject_alias_array_of_string) {
properties.set(IdentifiedObject::ALIAS_KEY,
std::vector<std::string>{"alias1", "alias2"});
auto obj = OperationParameter::create(properties);
ASSERT_EQ(obj->aliases().size(), 2);
ASSERT_EQ(obj->aliases().size(), 2U);
EXPECT_EQ(obj->aliases()[0]->toString(), "alias1");
EXPECT_EQ(obj->aliases()[1]->toString(), "alias2");
}
Expand Down
Loading