# C++ unit tests (dev-only; built solely when CMGRAPH_BUILD_TESTS=ON).
# Framework: vendored single-header doctest v2.4.11 (tests/cpp/vendor/ — MIT,
# dev-only, satisfies the stdlib-only rule for shipped code; PLAN.md §8).

add_executable(
  cmgraph_cpp_tests
  test_sanity.cpp
  test_key_codec.cpp
  test_rounding.cpp
  test_grid.cpp
  test_refine.cpp
  test_dynamics_cache.cpp
  test_cell_map.cpp
  test_dataset.cpp
  test_graph.cpp
  test_engine.cpp
  test_engine_refine.cpp
  test_topology.cpp
  test_index_map.cpp
  test_conley_indexmap.cpp
  test_index_pair.cpp
  test_conley.cpp
  test_spurious.cpp
  test_parallel.cpp)
target_include_directories(
  cmgraph_cpp_tests PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/vendor"
                            "${PROJECT_SOURCE_DIR}/include")
# T14 parallel cell-map build uses std::thread (see top-level CMakeLists Threads note).
target_link_libraries(cmgraph_cpp_tests PRIVATE Threads::Threads)
# MSVC: /bigobj for the template-heavy homology test TUs (C1128); silence std::getenv C4996.
if(MSVC)
  target_compile_options(cmgraph_cpp_tests PRIVATE /bigobj)
  target_compile_definitions(cmgraph_cpp_tests PRIVATE _CRT_SECURE_NO_WARNINGS)
endif()
add_test(NAME cmgraph_cpp_tests COMMAND cmgraph_cpp_tests)
