Cleanup in unit tests
parent
510fe6804a
commit
d879fa5fc9
|
@ -3,5 +3,66 @@ set(CMAKE_CXX_FLAGS "${COLOBOT_CXX_FLAGS} ${COLOBOT_GTEST_CXX_FLAGS}")
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE ${COLOBOT_CXX_FLAGS_RELEASE})
|
set(CMAKE_CXX_FLAGS_RELEASE ${COLOBOT_CXX_FLAGS_RELEASE})
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG ${COLOBOT_CXX_FLAGS_DEBUG})
|
set(CMAKE_CXX_FLAGS_DEBUG ${COLOBOT_CXX_FLAGS_DEBUG})
|
||||||
|
|
||||||
# Unit tests
|
# Unit test data
|
||||||
add_subdirectory(unit)
|
set(TEST_FILES
|
||||||
|
data/colobot.json
|
||||||
|
)
|
||||||
|
|
||||||
|
file(COPY ${TEST_FILES} DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||||
|
|
||||||
|
# Targets
|
||||||
|
add_definitions(-DGTEST_HAS_TR1_TUPLE=0)
|
||||||
|
|
||||||
|
add_executable(Colobot-UnitTests
|
||||||
|
src/main.cpp
|
||||||
|
|
||||||
|
src/app/app_test.cpp
|
||||||
|
|
||||||
|
src/CBot/CBot_test.cpp
|
||||||
|
src/CBot/CBotFileUtils_test.cpp
|
||||||
|
src/CBot/CBotToken_test.cpp
|
||||||
|
|
||||||
|
src/common/config_file_test.cpp
|
||||||
|
src/common/stringutils_test.cpp
|
||||||
|
src/common/timeutils_test.cpp
|
||||||
|
|
||||||
|
#src/graphics/engine/lightman_test.cpp
|
||||||
|
|
||||||
|
src/math/func_test.cpp
|
||||||
|
src/math/geometry_test.cpp
|
||||||
|
src/math/matrix_test.cpp
|
||||||
|
src/math/vector_test.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(Colobot-UnitTests PRIVATE
|
||||||
|
src/common
|
||||||
|
src/math
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${COLOBOT_LOCAL_INCLUDES}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
target_compile_options(Colobot-UnitTests PRIVATE /utf-8)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(Colobot-UnitTests PRIVATE
|
||||||
|
GTest::GTest
|
||||||
|
hippomocks
|
||||||
|
Colobot-Base
|
||||||
|
)
|
||||||
|
|
||||||
|
gtest_discover_tests(Colobot-UnitTests
|
||||||
|
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
||||||
|
DISCOVERY_MODE PRE_TEST
|
||||||
|
)
|
||||||
|
|
||||||
|
# GoogleTest isn't compatible with -Wsuggest-override -Werror:
|
||||||
|
# see https://github.com/google/googletest/issues/1063
|
||||||
|
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
|
||||||
|
target_compile_options(Colobot-UnitTests PRIVATE "-Wno-suggest-override")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(COLOBOT_LINT_BUILD)
|
||||||
|
add_fake_header_sources("test/unit" Colobot-UnitTests)
|
||||||
|
endif()
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
set(TEST_FILES
|
|
||||||
common/colobot.json
|
|
||||||
)
|
|
||||||
|
|
||||||
file(COPY ${TEST_FILES} DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
|
||||||
|
|
||||||
# Targets
|
|
||||||
|
|
||||||
add_definitions(-DGTEST_HAS_TR1_TUPLE=0)
|
|
||||||
|
|
||||||
add_executable(Colobot-UnitTests
|
|
||||||
main.cpp
|
|
||||||
app/app_test.cpp
|
|
||||||
CBot/CBot_test.cpp
|
|
||||||
CBot/CBotFileUtils_test.cpp
|
|
||||||
CBot/CBotToken_test.cpp
|
|
||||||
common/config_file_test.cpp
|
|
||||||
common/stringutils_test.cpp
|
|
||||||
common/timeutils_test.cpp
|
|
||||||
#graphics/engine/lightman_test.cpp
|
|
||||||
math/func_test.cpp
|
|
||||||
math/geometry_test.cpp
|
|
||||||
math/matrix_test.cpp
|
|
||||||
math/vector_test.cpp)
|
|
||||||
|
|
||||||
target_include_directories(Colobot-UnitTests PRIVATE
|
|
||||||
common
|
|
||||||
math
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
|
||||||
${COLOBOT_LOCAL_INCLUDES}
|
|
||||||
)
|
|
||||||
|
|
||||||
if(MSVC)
|
|
||||||
target_compile_options(Colobot-UnitTests PRIVATE /utf-8)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_link_libraries(Colobot-UnitTests PRIVATE GTest::GTest hippomocks Colobot-Base)
|
|
||||||
|
|
||||||
gtest_discover_tests(Colobot-UnitTests
|
|
||||||
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
|
||||||
DISCOVERY_MODE PRE_TEST
|
|
||||||
)
|
|
||||||
|
|
||||||
# GoogleTest isn't compatible with -Wsuggest-override -Werror:
|
|
||||||
# see https://github.com/google/googletest/issues/1063
|
|
||||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
|
|
||||||
target_compile_options(Colobot-UnitTests PRIVATE "-Wno-suggest-override")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(COLOBOT_LINT_BUILD)
|
|
||||||
add_fake_header_sources("test/unit" Colobot-UnitTests)
|
|
||||||
endif()
|
|
Loading…
Reference in New Issue