find_package(doctest QUIET)

add_executable(openpu_tests
  main.cpp
  test_vin.cpp
  test_models.cpp
  test_http.cpp
  test_api_client.cpp
  test_download.cpp
  test_archive.cpp
  test_storage.cpp
  test_usb.cpp
  test_app_update.cpp
)
find_package(LibArchive REQUIRED)
target_link_libraries(openpu_tests PRIVATE openpu_core openpu_warnings LibArchive::LibArchive)
if(TARGET doctest::doctest)
  target_link_libraries(openpu_tests PRIVATE doctest::doctest)
endif()
target_compile_definitions(openpu_tests PRIVATE OPENPU_FIXTURES_DIR="${CMAKE_CURRENT_SOURCE_DIR}/fixtures")

add_test(NAME openpu_tests COMMAND openpu_tests)
