<commit_before>function(chrp_cpp_test _file_)
    get_filename_component(_name_ ${_file_} NAME_WE)
    add_executable(${_name_} ${_file_} $<TARGET_OBJECTS:catch>)
    target_link_libraries(${_name_} chemharp)
    set_property(TARGET ${_name_} PROPERTY CXX_STANDARD 11)
    add_test(${_name_} ${_name_})
endfunction()

if(BUILD_TESTS)
    include_directories(${CMAKE_SOURCE_DIR}/include)
    include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/catch)
    add_library(catch OBJECT ${CMAKE_CURRENT_SOURCE_DIR}/catch/catch.cpp)

    add_library(libtest SHARED ${CMAKE_CURRENT_SOURCE_DIR}/test.c)
    set_target_properties(libtest PROPERTIES PREFIX "" SUFFIX ".so")

    file(GLOB all_test_files
        ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/files/*.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/formats/*.cpp
    )

    add_definitions("-DSRCDIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"")
    add_definitions("-DBINDIR=\"${CMAKE_CURRENT_BINARY_DIR}\"")

    foreach(test_file IN LISTS all_test_files)
        chrp_cpp_test(${test_file})
    endforeach(test_file)
endif()

# Because the files may not be installed yet, we use the environment variable
set_tests_properties(molfile
PROPERTIES ENVIRONMENT "CHRP_MOLFILES=${CMAKE_BINARY_DIR}/lib/")
<commit_msg>Only set test property when building tests<commit_after>function(chrp_cpp_test _file_)
    get_filename_component(_name_ ${_file_} NAME_WE)
    add_executable(${_name_} ${_file_} $<TARGET_OBJECTS:catch>)
    target_link_libraries(${_name_} chemharp)
    set_property(TARGET ${_name_} PROPERTY CXX_STANDARD 11)
    add_test(${_name_} ${_name_})
endfunction()

if(BUILD_TESTS)
    include_directories(${CMAKE_SOURCE_DIR}/include)
    include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/catch)
    add_library(catch OBJECT ${CMAKE_CURRENT_SOURCE_DIR}/catch/catch.cpp)

    add_library(libtest SHARED ${CMAKE_CURRENT_SOURCE_DIR}/test.c)
    set_target_properties(libtest PROPERTIES PREFIX "" SUFFIX ".so")

    file(GLOB all_test_files
        ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/files/*.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/formats/*.cpp
    )

    add_definitions("-DSRCDIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"")
    add_definitions("-DBINDIR=\"${CMAKE_CURRENT_BINARY_DIR}\"")

    foreach(test_file IN LISTS all_test_files)
        chrp_cpp_test(${test_file})
    endforeach(test_file)

    # Because the files may not be installed yet, we use the environment variable
    set_tests_properties(molfile
    PROPERTIES ENVIRONMENT "CHRP_MOLFILES=${CMAKE_BINARY_DIR}/lib/")
endif()

{'fraction_non_alphanumeric': 0.11528046421663443, 'fraction_numerical': 0.0015473887814313346, 'mean_word_length': 5.385185185185185, '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': '4079844', 'n_tokens_mistral': 948, 'n_tokens_neox': 904, 'n_words': 134}