# Unit tests for the SDK-independent core (fgc_core). No Vimba X / Paho needed,
# so these run anywhere - including CI with -DWITH_VIMBA=OFF -DWITH_MQTT=OFF.

include(FetchContent)

# doctest from the official upstream, pinned. For maximum integrity pin to a
# commit SHA or add URL_HASH of a release tarball.
set(DOCTEST_TAG "v2.4.11" CACHE STRING "doctest git tag/commit")
FetchContent_Declare(doctest
  GIT_REPOSITORY https://github.com/doctest/doctest.git
  GIT_TAG        ${DOCTEST_TAG}
  GIT_SHALLOW    TRUE
)
# doctest's bundled CMakeLists uses a cmake_minimum_required below CMake 4's
# floor; allow it to configure under modern CMake.
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
FetchContent_MakeAvailable(doctest)
unset(CMAKE_POLICY_VERSION_MINIMUM)

add_executable(fgc_tests
  doctest_main.cpp
  test_paths.cpp
  test_config.cpp
  test_telemetry.cpp
  test_command.cpp
  test_scheduler.cpp
  test_logger.cpp
  test_geometry.cpp
  test_scangrid.cpp
  test_uisnapshot.cpp
  test_mtiprotocol.cpp
  test_dumpparser.cpp
  test_helptext.cpp
  test_diagparser.cpp
  test_calibration.cpp
  test_calibroutine.cpp
  test_testreport.cpp
  test_hostmetrics.cpp
  test_testrunner.cpp
)
target_link_libraries(fgc_tests PRIVATE fgc_core doctest::doctest)

include(${doctest_SOURCE_DIR}/scripts/cmake/doctest.cmake)
doctest_discover_tests(fgc_tests)
