# ── Test targets ────────────────────────────────────────────────────────────── include(CTest) include(Catch) # pthread is required on Linux for Catch2 tests find_package(Threads REQUIRED) # Unit tests — one per package add_executable(test_logger unit/test_logger.cpp) target_link_libraries(test_logger PRIVATE Catch2::Catch2WithMain logger Threads::Threads) catch_discover_tests(test_logger) add_executable(test_html unit/test_html.cpp) target_link_libraries(test_html PRIVATE Catch2::Catch2WithMain html Threads::Threads) catch_discover_tests(test_html) add_executable(test_postgres unit/test_postgres.cpp) target_link_libraries(test_postgres PRIVATE Catch2::Catch2WithMain postgres Threads::Threads) catch_discover_tests(test_postgres) add_executable(test_json unit/test_json.cpp) target_link_libraries(test_json PRIVATE Catch2::Catch2WithMain json Threads::Threads) catch_discover_tests(test_json) add_executable(test_http unit/test_http.cpp) target_link_libraries(test_http PRIVATE Catch2::Catch2WithMain http Threads::Threads) catch_discover_tests(test_http) # Functional test — end-to-end CLI add_executable(test_functional functional/test_cli.cpp) target_link_libraries(test_functional PRIVATE Catch2::Catch2WithMain CLI11::CLI11 tomlplusplus::tomlplusplus logger html postgres http json Threads::Threads) catch_discover_tests(test_functional) # E2E test — real Supabase connection (requires config/postgres.toml + network) add_executable(test_supabase e2e/test_supabase.cpp) target_link_libraries(test_supabase PRIVATE Catch2::Catch2WithMain tomlplusplus::tomlplusplus logger postgres json Threads::Threads) catch_discover_tests(test_supabase WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) add_executable(test_postgres_live functional/test_postgres_live.cpp) target_link_libraries(test_postgres_live PRIVATE Catch2::Catch2WithMain postgres search json logger tomlplusplus::tomlplusplus Threads::Threads) catch_discover_tests(test_postgres_live WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) add_executable(test_polymech unit/test_polymech.cpp) target_link_libraries(test_polymech PRIVATE Catch2::Catch2WithMain polymech postgres Threads::Threads) catch_discover_tests(test_polymech) # E2E test — polymech fetch_pages from live Supabase add_executable(test_polymech_e2e e2e/test_polymech_e2e.cpp) target_link_libraries(test_polymech_e2e PRIVATE Catch2::Catch2WithMain tomlplusplus::tomlplusplus logger postgres polymech json Threads::Threads) catch_discover_tests(test_polymech_e2e WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) add_executable(test_ipc unit/test_ipc.cpp) target_link_libraries(test_ipc PRIVATE Catch2::Catch2WithMain ipc Threads::Threads) catch_discover_tests(test_ipc) add_executable(test_geo unit/test_geo.cpp) target_link_libraries(test_geo PRIVATE Catch2::Catch2WithMain geo Threads::Threads) catch_discover_tests(test_geo) add_executable(test_gadm_reader unit/test_gadm_reader.cpp) target_link_libraries(test_gadm_reader PRIVATE Catch2::Catch2WithMain gadm_reader Threads::Threads) catch_discover_tests(test_gadm_reader WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) add_executable(test_grid unit/test_grid.cpp) target_link_libraries(test_grid PRIVATE Catch2::Catch2WithMain grid Threads::Threads) catch_discover_tests(test_grid WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) add_executable(test_search unit/test_search.cpp) target_link_libraries(test_search PRIVATE Catch2::Catch2WithMain search Threads::Threads) catch_discover_tests(test_search WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) add_executable(test_enrichers unit/test_enrichers.cpp) target_link_libraries(test_enrichers PRIVATE Catch2::Catch2WithMain enrichers Threads::Threads) catch_discover_tests(test_enrichers)