<commit_before># -*- mode: CMAKE; -*-

# options
option(BuildTests "Build test suite" OFF)
message(STATUS "Building test suite: ${BuildTests}")

option(BuildLargeTests "Build large tests" OFF)
message(STATUS "Building large tests: ${BuildLargeTests}")
  
option(BuildAsmTest "Build assembler test code" OFF)
message(STATUS "Building assembler test suite: ${BuildAsmTest}")

set(Tests
    testsAliases
    testsBuffer
    testsBuilder
    testsCollection
    testsCommon
    testsCompare
    testsDumper
    testsException
    testsFiles
    testsHexDump
    testsIterator
    testsLookup
    testsParser
    testsSlice
    testsSliceContainer
    testsType
    testsValidator
    testsVersion
)

macro(standard_test test_name)
    set(testName ${test_name})
    if("${ARGV1}" STREQUAL "")
        set(testCpp ${testName}.cpp)
    else()
        set(testCpp ${ARGV1})
    endif()

    include_directories(${testName} PRIVATE ${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
    add_executable(${testName} ${testCpp})
    target_link_libraries(${testName} gtest velocypack ${CMAKE_THREAD_LIBS_INIT})
    add_test(${testName} ${testName})
endmacro()

# build tests.cpp
if(BuildTests)
    include(CTest)
    enable_testing()
    find_package(Threads REQUIRED)
    add_subdirectory(googletest/googletest REQUIRED)

    foreach(testName ${Tests})
        standard_test(${testName})
    endforeach()
    file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/jsonSample" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/")

    if(BuildLargeTests)
        standard_test(testsLarge)
    endif()
endif()

# build AsmTest<commit_msg>try to fix gtest compilation<commit_after># -*- mode: CMAKE; -*-

# options
option(BuildTests "Build test suite" OFF)
message(STATUS "Building test suite: ${BuildTests}")

option(BuildLargeTests "Build large tests" OFF)
message(STATUS "Building large tests: ${BuildLargeTests}")
  
option(BuildAsmTest "Build assembler test code" OFF)
message(STATUS "Building assembler test suite: ${BuildAsmTest}")

set(Tests
    testsAliases
    testsBuffer
    testsBuilder
    testsCollection
    testsCommon
    testsCompare
    testsDumper
    testsException
    testsFiles
    testsHexDump
    testsIterator
    testsLookup
    testsParser
    testsSlice
    testsSliceContainer
    testsType
    testsValidator
    testsVersion
)

macro(standard_test test_name)
    set(testName ${test_name})
    if("${ARGV1}" STREQUAL "")
        set(testCpp ${testName}.cpp)
    else()
        set(testCpp ${ARGV1})
    endif()

    include_directories(${testName} PRIVATE ${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
    add_executable(${testName} ${testCpp})
    target_link_libraries(${testName} gtest velocypack ${CMAKE_THREAD_LIBS_INIT})
    add_test(${testName} ${testName})
endmacro()

# build tests.cpp
if(BuildTests)
    include(CTest)
    enable_testing()
    find_package(Threads REQUIRED)
    add_subdirectory(googletest REQUIRED)

    foreach(testName ${Tests})
        standard_test(${testName})
    endforeach()
    file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/jsonSample" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/")

    if(BuildLargeTests)
        standard_test(testsLarge)
    endif()
endif()

# build AsmTest
{'fraction_non_alphanumeric': 0.10462211118051218, 'fraction_numerical': 0.0012492192379762648, 'mean_word_length': 4.250819672131148, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2601879', 'n_tokens_mistral': 1037, 'n_tokens_neox': 1003, 'n_words': 209}