add_subdirectory(test_utils)

file(COPY data/ DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_data)

set(TEST_MODULES 
    audio 
    compiler 
    compression 
    core 
    database 
    fonts 
    graphics 
    image 
    ipc 
    network 
    publishing 
    video
    web
    windows)

foreach(module ${TEST_MODULES})
    add_subdirectory(${module})
    string(TOUPPER ${module} MODULE_UPPER)
    list(APPEND UNIT_TEST_FILES ${${MODULE_UPPER}_UNIT_TEST_FILES})
    list(APPEND UNIT_TEST_DEPENDENCIES ${${MODULE_UPPER}_UNIT_TEST_DEPENDENCIES})
    
    list(APPEND INTEGRATION_TEST_FILES ${${MODULE_UPPER}_INTEGRATION_TEST_FILES})
    list(APPEND INTEGRATION_TEST_DEPENDENCIES ${${MODULE_UPPER}_INTEGRATION_TEST_DEPENDENCIES})
endforeach()

add_executable(unit_tests test_runner.cpp ${UNIT_TEST_FILES})
target_link_libraries(unit_tests PUBLIC test_utils ${UNIT_TEST_DEPENDENCIES})

add_executable(integration_tests test_runner.cpp ${INTEGRATION_TEST_FILES})
target_link_libraries(integration_tests PUBLIC test_utils ${INTEGRATION_TEST_DEPENDENCIES})
