55 lines
2.7 KiB
CMake
55 lines
2.7 KiB
CMake
# ── 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_polymech unit/test_polymech.cpp)
|
|
target_link_libraries(test_polymech PRIVATE Catch2::Catch2WithMain polymech postgres Threads::Threads)
|
|
catch_discover_tests(test_polymech)
|
|
|
|
add_executable(test_cmd_kbot unit/test_cmd_kbot.cpp ../src/cmd_kbot.cpp)
|
|
target_link_libraries(test_cmd_kbot PRIVATE Catch2::Catch2WithMain CLI11::CLI11 logger tomlplusplus::tomlplusplus kbot Threads::Threads)
|
|
catch_discover_tests(test_cmd_kbot)
|
|
|
|
# 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)
|