# Tests CMakeLists.txt include(FetchContent) # Download and configure Google Test FetchContent_Declare( googletest URL https://github.com/google/googletest/archive/v1.14.0.zip DOWNLOAD_EXTRACT_TIMESTAMP TRUE ) # Prevent overriding the parent project's compiler/linker on Windows set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) # Make Google Test available FetchContent_MakeAvailable(googletest) # Include Google Test modules include(GoogleTest) include(${CMAKE_SOURCE_DIR}/cmake/modules/CompilerWarnings.cmake) # Disable problematic warnings for Google Test targets if(TARGET gtest) disable_third_party_warnings(gtest) endif() if(TARGET gmock) disable_third_party_warnings(gmock) endif() if(TARGET gtest_main) disable_third_party_warnings(gtest_main) endif() if(TARGET gmock_main) disable_third_party_warnings(gmock_main) endif() # Create test executable for unit tests add_executable(unit_tests unit/main.cpp ) # Link with Google Test and our library target_link_libraries(unit_tests PRIVATE GTest::gtest_main GTest::gmock_main PokEng::pokemon_battle_sim ) # Set up test discovery gtest_discover_tests(unit_tests WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTIES LABELS "unit" ) # Create test executable for integration tests add_executable(integration_tests integration/main.cpp ) # Link with Google Test and our library target_link_libraries(integration_tests PRIVATE GTest::gtest_main GTest::gmock_main PokEng::pokemon_battle_sim ) # Set up test discovery gtest_discover_tests(integration_tests WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTIES LABELS "integration" ) # Include directories for tests target_include_directories(unit_tests PRIVATE ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src ) target_include_directories(integration_tests PRIVATE ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src ) # Add test subdirectories add_subdirectory(unit) add_subdirectory(integration)