2016-05-19 23:28:12 +02:00
|
|
|
##############################################################################
|
|
|
|
# Unit Tests
|
|
|
|
##############################################################################
|
|
|
|
|
2017-10-26 01:47:29 +02:00
|
|
|
find_package(Boost COMPONENTS filesystem unit_test_framework system REQUIRED)
|
2016-05-19 23:28:12 +02:00
|
|
|
|
2016-04-15 02:06:10 +02:00
|
|
|
set(TEST_SOURCES
|
2017-10-26 01:03:15 +02:00
|
|
|
main.cpp
|
2017-10-26 03:51:24 +02:00
|
|
|
test_Globals.cpp
|
|
|
|
test_Animation.cpp
|
|
|
|
test_Archive.cpp
|
|
|
|
test_Buoyancy.cpp
|
|
|
|
test_Character.cpp
|
|
|
|
test_Chase.cpp
|
|
|
|
test_Cutscene.cpp
|
|
|
|
test_Config.cpp
|
|
|
|
test_Data.cpp
|
2017-10-26 01:03:15 +02:00
|
|
|
test_FileIndex.cpp
|
|
|
|
test_GameData.cpp
|
|
|
|
test_GameWorld.cpp
|
2017-10-26 03:51:24 +02:00
|
|
|
test_Globals.hpp
|
|
|
|
test_Items.cpp
|
2017-10-26 01:03:15 +02:00
|
|
|
test_Input.cpp
|
2017-10-26 03:51:24 +02:00
|
|
|
test_Lifetime.cpp
|
|
|
|
test_Loaderdff.cpp
|
2017-10-26 01:03:15 +02:00
|
|
|
test_LoaderIPL.cpp
|
|
|
|
test_Logger.cpp
|
2017-10-26 03:51:24 +02:00
|
|
|
test_Menu.cpp
|
|
|
|
test_Object.cpp
|
|
|
|
test_ObjectData.cpp
|
|
|
|
test_Pickup.cpp
|
|
|
|
test_Renderer.cpp
|
|
|
|
test_RWBStream.cpp
|
2017-10-26 01:03:15 +02:00
|
|
|
test_SaveGame.cpp
|
2017-10-26 03:51:24 +02:00
|
|
|
test_ScriptMachine.cpp
|
|
|
|
test_State.cpp
|
|
|
|
test_Text.cpp
|
|
|
|
test_TrafficDirector.cpp
|
|
|
|
test_Vehicle.cpp
|
2017-10-26 01:03:15 +02:00
|
|
|
test_VisualFX.cpp
|
2017-10-26 03:51:24 +02:00
|
|
|
test_Weapon.cpp
|
|
|
|
test_World.cpp
|
2017-10-26 01:03:15 +02:00
|
|
|
test_ZoneData.cpp
|
2016-05-20 03:09:22 +02:00
|
|
|
|
2017-10-26 01:03:15 +02:00
|
|
|
# Hack in rwgame sources until there's a per-target test suite
|
|
|
|
"${CMAKE_SOURCE_DIR}/rwgame/GameConfig.cpp"
|
|
|
|
"${CMAKE_SOURCE_DIR}/rwgame/GameWindow.cpp"
|
|
|
|
"${CMAKE_SOURCE_DIR}/rwgame/GameInput.cpp"
|
|
|
|
)
|
2013-09-11 13:10:42 +02:00
|
|
|
|
2016-04-15 02:06:10 +02:00
|
|
|
add_executable(run_tests ${TEST_SOURCES})
|
2013-09-11 13:10:42 +02:00
|
|
|
|
2017-10-26 00:44:45 +02:00
|
|
|
target_compile_definitions(run_tests
|
|
|
|
PRIVATE
|
|
|
|
"RW_TEST_WITH_DATA=$<NOT:$<BOOL:${TESTS_NODATA}>>"
|
|
|
|
"BOOST_TEST_DYN_LINK"
|
|
|
|
)
|
2013-09-11 13:10:42 +02:00
|
|
|
|
2017-10-26 00:44:45 +02:00
|
|
|
target_include_directories(run_tests
|
|
|
|
SYSTEM
|
|
|
|
PRIVATE
|
2017-10-26 01:47:29 +02:00
|
|
|
${Boost_INCLUDE_DIRS}
|
2017-10-26 00:44:45 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(run_tests
|
|
|
|
PRIVATE
|
2017-10-26 01:03:15 +02:00
|
|
|
"${CMAKE_SOURCE_DIR}/tests"
|
|
|
|
"${CMAKE_SOURCE_DIR}/rwgame"
|
2017-10-26 00:44:45 +02:00
|
|
|
)
|
2013-09-11 13:10:42 +02:00
|
|
|
|
2014-08-17 00:02:34 +02:00
|
|
|
target_link_libraries(run_tests
|
2017-10-26 01:03:15 +02:00
|
|
|
PRIVATE
|
|
|
|
rwengine
|
2017-10-26 01:47:29 +02:00
|
|
|
SDL2::SDL2
|
2017-10-26 01:47:29 +02:00
|
|
|
${Boost_FILESYSTEM_LIBRARY}
|
2017-10-26 01:03:15 +02:00
|
|
|
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
|
2017-10-26 01:47:29 +02:00
|
|
|
${Boost_SYSTEM_LIBRARY}
|
2017-10-26 01:03:15 +02:00
|
|
|
)
|
2013-09-11 13:10:42 +02:00
|
|
|
|
2017-10-28 08:15:34 +02:00
|
|
|
add_test(NAME UnitTests
|
|
|
|
COMMAND "$<TARGET_FILE:run_tests>"
|
|
|
|
)
|