function(rapidfuzz_add_test test)
    if(Catch2_VERSION VERSION_LESS "3.0")
        add_executable(test_${test} ../tests-main.cpp tests-${test}.cpp examples/ocr.cpp examples/pythonLevenshteinIssue9.cpp)
        target_link_libraries(test_${test} PRIVATE Catch2::Catch2)
        target_compile_definitions(test_${test} PRIVATE CATCH2_VERSION=2)
    else()
        add_executable(test_${test} tests-${test}.cpp examples/ocr.cpp examples/pythonLevenshteinIssue9.cpp)
        target_link_libraries(test_${test} PRIVATE Catch2::Catch2WithMain)
        target_compile_definitions(test_${test} PRIVATE CATCH2_VERSION=3)
    endif()

    target_link_libraries(test_${test} PRIVATE ${PROJECT_NAME})
    if (RAPIDFUZZ_ENABLE_LINTERS)
        target_link_libraries(test_${test} PRIVATE project_warnings)
    endif()

    #target_compile_options(test_${test} PRIVATE -g -fsanitize=address)
    #target_link_libraries(test_${test} PRIVATE -fsanitize=address)

    add_test(NAME ${test} COMMAND test_${test})
endfunction()

rapidfuzz_add_test(Hamming)
rapidfuzz_add_test(Indel)
rapidfuzz_add_test(LCSseq)
rapidfuzz_add_test(Levenshtein)
rapidfuzz_add_test(DamerauLevenshtein)
rapidfuzz_add_test(OSA)
rapidfuzz_add_test(Jaro)
rapidfuzz_add_test(JaroWinkler)
