# daemon unit + integration tests. Registered with ctest; run via `ctest --preset dev`.
# No external test framework — each file is a small self-checking binary.

function(veloxd_test name)
    cmake_parse_arguments(T "" "" "LIBS" ${ARGN})
    add_executable(veloxd_${name}_test ${name}_test.cpp)
    target_link_libraries(veloxd_${name}_test PRIVATE ${T_LIBS})
    target_compile_options(veloxd_${name}_test PRIVATE -Wall -Wextra -Wpedantic -Werror)
    add_test(NAME veloxd.${name} COMMAND veloxd_${name}_test)
    set_tests_properties(veloxd.${name} PROPERTIES TIMEOUT 30)
endfunction()

veloxd_test(ndjson           LIBS veloxd_rpc)
veloxd_test(uds_roundtrip     LIBS veloxd_rpc veloxd_store)
veloxd_test(store_migrations  LIBS veloxd_store)
veloxd_test(pairings          LIBS veloxd_store veloxd_rpc)
veloxd_test(ws_frame          LIBS veloxd_rpc)
veloxd_test(ws_server         LIBS veloxd_rpc veloxd_store)
veloxd_test(sched_window     LIBS veloxd_sched)
veloxd_test(sched_governor   LIBS veloxd_sched)
veloxd_test(safepath         LIBS veloxd_fs)
veloxd_test(store_tasks      LIBS veloxd_store)
veloxd_test(sched_scheduler  LIBS veloxd_sched veloxd_rpc)
veloxd_test(event_hub               LIBS veloxd_rpc)
veloxd_test(store_categories_queues LIBS veloxd_store)
