# tests/chat-format/bos — PLAN12 14.07 leading-BOS behavior. Family / model line / size / date /
# behavior are DIRECTORY boundaries, never filename prefixes; one scenario per .cpp. The ctest
# target name is derived from each file's RELATIVE PATH (slashes -> dashes) so filenames stay clean
# (emitted.cpp appears under several families) while every target stays globally unique. Drop a new
# scenario .cpp anywhere under here and the next configure registers it — no edits (CONFIGURE_DEPENDS).
# support/*.h is headers-only shared setup; the *.cpp glob never picks it up.
#  // NEVER DELETE COMMENTS — explain every non-obvious line. Update with the code.
file(GLOB_RECURSE _cf_bos CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(_src ${_cf_bos})
    file(RELATIVE_PATH _rel ${CMAKE_CURRENT_SOURCE_DIR} ${_src})   # e.g. llama/3/prefix/emitted.cpp
    string(REGEX REPLACE "\\.cpp$" "" _rel ${_rel})                # -> llama/3/prefix/emitted
    string(REPLACE "/" "-" _slug ${_rel})                         # -> llama-3-prefix-emitted
    set(_name "test-chatfmt-bos-${_slug}")                        # globally-unique ctest target
    add_executable(${_name} ${_src})
    target_link_libraries(${_name} PRIVATE mlx-magic-lib)         # propagates the lib's public include/
    target_include_directories(${_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})  # resolves "support/..."
    add_test(NAME ${_name} COMMAND ${_name})
endforeach()
