function(vls_test_suite target)
    add_executable(${target} ${ARGN})
    target_link_libraries(${target} PRIVATE vls_protocol Void::Testing)
    set_target_properties(${target} PROPERTIES VOID_TESTING_NO_AUTO_SCAN TRUE)
    add_test(NAME ${target} COMMAND ${target})
    set_tests_properties(${target} PROPERTIES TIMEOUT 30)
endfunction()

vls_test_suite(vls_unit_tests FramingTests.cpp JsonTests.cpp LifecycleTests.cpp ProtocolEncodingTests.cpp)
vls_test_suite(vls_json_capabilities JsonCapabilities.cpp)
vls_test_suite(vls_process_tests ProcessTests.cpp ProviderProcessTests.cpp)
vls_test_suite(vls_document_tests documents/DocumentTests.cpp documents/LongLineTests.cpp
    documents/BoundInputTests.cpp)
vls_test_suite(vls_workspace_tests workspace/WorkspaceTests.cpp workspace/ProviderSessionTests.cpp
    workspace/SemanticLeaseTests.cpp)
vls_test_suite(vls_build_model_tests providers/ModelTests.cpp)
vls_test_suite(vls_diagnostic_tests semantic/DiagnosticTests.cpp semantic/SourceCatalogTests.cpp
    semantic/OccurrenceTests.cpp)
vls_test_suite(vls_module_tests modules/ModuleGraphTests.cpp modules/ArtifactCacheTests.cpp
    modules/ModuleWorkQueueTests.cpp modules/ScanCommandTests.cpp)
vls_test_suite(vls_scheduler_tests scheduler/SchedulerTests.cpp)
vls_test_suite(vls_index_tests index/SymbolIndexTests.cpp)
vls_test_suite(vls_navigation_tests navigation/NavigationTests.cpp)
vls_test_suite(vls_reflection_tests reflection/ProvenanceTests.cpp)
vls_test_suite(vls_feature_tests features/CompletionTests.cpp features/IndexNavigationTests.cpp features/SignatureHelpTests.cpp features/DocumentSymbolsTests.cpp features/TextStructureTests.cpp features/CodeActionsTests.cpp features/SemanticTokensTests.cpp features/InlayHintsTests.cpp features/FileOperationsTests.cpp features/IncludeUpdateTests.cpp features/CallHierarchyTests.cpp features/CodeLensTests.cpp)
vls_test_suite(vls_live_tests debug/LiveSessionTests.cpp debug/LiveDapTests.cpp)
target_link_libraries(vls_live_tests PRIVATE Void::System)
add_dependencies(vls_live_tests vls_live_worker_fixture vls-dap)
set_tests_properties(vls_live_tests PROPERTIES LABELS live-debug)
set_tests_properties(vls_scheduler_tests PROPERTIES LABELS scheduler)
set_tests_properties(vls_index_tests PROPERTIES LABELS index)
set_tests_properties(vls_navigation_tests PROPERTIES LABELS navigation-rename)
set_tests_properties(vls_reflection_tests PROPERTIES LABELS reflection)
set_tests_properties(vls_feature_tests PROPERTIES LABELS completion-hover)
set_tests_properties(vls_module_tests PROPERTIES LABELS module-graph)
set_tests_properties(vls_diagnostic_tests PROPERTIES LABELS gcc-diagnostics)
add_executable(vls_gcc_diagnostic_fixture semantic/GccDiagnosticFixture.cpp)
target_link_libraries(vls_gcc_diagnostic_fixture PRIVATE vls_protocol)
add_executable(vls_module_scan_fixture modules/GccScanFixture.cpp)
target_link_libraries(vls_module_scan_fixture PRIVATE vls_protocol)
add_executable(vls_live_worker_fixture debug/LiveWorkerFixture.cpp)
target_link_libraries(vls_live_worker_fixture PRIVATE vls_protocol)
add_executable(vls_module_artifact_fixture modules/ModuleArtifactFixture.cpp)
target_link_libraries(vls_module_artifact_fixture PRIVATE vls_protocol Void::System)
vls_test_suite(vls_trace_tests debug/TraceTests.cpp debug/RecordingTests.cpp)
target_link_libraries(vls_trace_tests PRIVATE vls_gcc_trace)
set_tests_properties(vls_trace_tests PROPERTIES LABELS trace-replay TIMEOUT 120)
vls_test_suite(vls_dap_tests debug/DapReplayTests.cpp)
target_link_libraries(vls_dap_tests PRIVATE vls_gcc_trace Void::System)
target_compile_definitions(vls_dap_tests PRIVATE "VLS_DAP_EXECUTABLE=\"$<TARGET_FILE:vls-dap>\"")
add_dependencies(vls_dap_tests vls-dap)
set_tests_properties(vls_dap_tests PROPERTIES LABELS "dap;inspection")
vls_test_suite(vls_provider_tests providers/ProviderFileTests.cpp providers/VbsProviderTests.cpp
    providers/CompdbProviderTests.cpp providers/CommandImportTests.cpp)
set_tests_properties(vls_provider_tests PROPERTIES LABELS "vbs-provider;compdb")
set_tests_properties(vls_build_model_tests PROPERTIES LABELS build-model)
set_tests_properties(vls_document_tests PROPERTIES LABELS documents)
set_tests_properties(vls_workspace_tests PROPERTIES LABELS workspace)

foreach(target IN ITEMS vls_json_capabilities vls_process_tests)
    target_link_libraries(${target} PRIVATE Void::System)
    target_compile_definitions(${target} PRIVATE "VLS_EXECUTABLE=\"$<TARGET_FILE:vls>\"")
    add_dependencies(${target} vls)
endforeach()

add_executable(vls_test_registration NativeRegistration.cpp)
target_link_libraries(vls_test_registration PRIVATE Void::System)
add_dependencies(vls_test_registration vls_unit_tests vls_json_capabilities vls_process_tests
    vls_document_tests vls_workspace_tests vls_build_model_tests vls_provider_tests vls_trace_tests
    vls_diagnostic_tests vls_module_tests vls_dap_tests vls_scheduler_tests vls_index_tests vls_navigation_tests vls_reflection_tests vls_feature_tests vls_live_tests)
add_test(NAME vls_test_registration COMMAND vls_test_registration)
set_tests_properties(vls_test_registration PROPERTIES TIMEOUT 20)
