<commit_before>c4_setup_testing()

c4_add_library(ryml_util_test
    SOURCES test_case.hpp test_case.cpp libyaml.hpp
    INC_DIRS ${CMAKE_CURRENT_LIST_DIR} ${ryml_yaml_cpp_inc}
    LIBS ryml c4fs yaml yaml-cpp gtest gtest_main
    FOLDER test)

function(ryml_add_test test_name)
    # NOTE: the library order here is fragile because the c4proj sanitization
    # code goes recursively through the target and its dependencies to figure
    # out the include paths, and some of them use a generator expression
    # $<INSTALL_INTERFACE:include>, which for some reason cmake resolves to
    # an empty string; that results in an empty -I directive: for example "-I
    # -I other/path", which prevents clang-tidy from considering
    # other/path. The way that this could be overcome was by respecifying the
    # libraries, although technically it was not necessary for correct
    # compilation and linking. This is happening only with the clang-tidy
    # sanitizer.
    set(t ryml-test-${test_name})
    c4_add_executable(${t}
        SOURCES ${test_name}.cpp ${ARGN}
        LIBS ryml yaml-cpp ryml_util_test yaml-cpp ryml # FRAGILE! see the NOTE above
        FOLDER test)
    if(RYML_DBG)
        target_compile_definitions(${t} PRIVATE RYML_DBG)
    endif()
    c4_add_test(${t})
endfunction()

function(ryml_add_test_case_group name)
    ryml_add_test(${name} test_group.cpp test_group.hpp)
endfunction()

ryml_add_test(basic)
ryml_add_test(basic_json)<commit_msg>rename ryml_util_test to ryml-testlib<commit_after>c4_setup_testing()

c4_add_library(ryml-testlib
    SOURCES test_case.hpp test_case.cpp libyaml.hpp
    INC_DIRS ${CMAKE_CURRENT_LIST_DIR} ${ryml_yaml_cpp_inc}
    LIBS ryml c4fs yaml yaml-cpp gtest gtest_main
    FOLDER test)

function(ryml_add_test test_name)
    # NOTE: the library order here is fragile because the c4proj sanitization
    # code goes recursively through the target and its dependencies to figure
    # out the include paths, and some of them use a generator expression
    # $<INSTALL_INTERFACE:include>, which for some reason cmake resolves to
    # an empty string; that results in an empty -I directive: for example "-I
    # -I other/path", which prevents clang-tidy from considering
    # other/path. The way that this could be overcome was by respecifying the
    # libraries, although technically it was not necessary for correct
    # compilation and linking. This is happening only with the clang-tidy
    # sanitizer.
    set(t ryml-test-${test_name})
    c4_add_executable(${t}
        SOURCES ${test_name}.cpp ${ARGN}
        LIBS ryml yaml-cpp ryml-testlib yaml-cpp ryml # FRAGILE! see the NOTE above
        FOLDER test)
    if(RYML_DBG)
        target_compile_definitions(${t} PRIVATE RYML_DBG)
    endif()
    c4_add_test(${t})
endfunction()

function(ryml_add_test_case_group name)
    ryml_add_test(${name} test_group.cpp test_group.hpp)
endfunction()

ryml_add_test(basic)
ryml_add_test(basic_json)
{'fraction_non_alphanumeric': 0.07263513513513513, 'fraction_numerical': 0.004054054054054054, 'mean_word_length': 3.959798994974874, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4291172', 'n_tokens_mistral': 1011, 'n_tokens_neox': 952, 'n_words': 298}