# tests/arch — per-architecture-pack tests. Directory structure MIRRORS src/arch/, so a
# test's path names the exact production concern it guards (arch/deepseek/v2/mla/cache/reset
# guards src/arch/deepseek/v2/mla/cache.cpp's reset lifecycle). One behavior per .cpp; the
# ctest target name is derived from the RELATIVE PATH (slashes -> dashes) so leaf filenames
# stay short and descriptive while every target stays globally unique. Drop a .cpp anywhere
# under here and the next configure registers it — no edits (CONFIGURE_DEPENDS).
# Same registration pattern as tests/chat-format/bos.
#  // NEVER DELETE COMMENTS — explain every non-obvious line. Update with the code.
file(GLOB_RECURSE _arch_tests CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(_src ${_arch_tests})
    file(RELATIVE_PATH _rel ${CMAKE_CURRENT_SOURCE_DIR} ${_src})   # deepseek/v2/mla/cache/reset/consumed-once.cpp
    string(REGEX REPLACE "\\.cpp$" "" _rel ${_rel})
    string(REPLACE "/" "-" _slug ${_rel})                          # deepseek-v2-mla-cache-reset-consumed-once
    set(_name "test-arch-${_slug}")
    add_executable(${_name} ${_src})
    target_link_libraries(${_name} PRIVATE mlx-magic-lib)
    add_test(NAME ${_name} COMMAND ${_name})
endforeach()
