include_directories(
    ${CMAKE_SOURCE_DIR}/src
)

add_executable(connection_test
    connection_test.cpp
)

if(WIN32)
    target_link_libraries (connection_test httppp-static ws2_32)
else()
    target_link_libraries (connection_test httppp-static)
endif()

add_test(connection_test connection_test)

add_executable(httpd_h2_concurrency_test
    httpd_h2_concurrency_test.cpp
)

if(WIN32)
    target_link_libraries (httpd_h2_concurrency_test httppp-static ws2_32)
else()
    target_link_libraries (httpd_h2_concurrency_test httppp-static)
endif()

add_test(httpd_h2_concurrency_test httpd_h2_concurrency_test)

add_executable(httpd_h1_offload_test
    httpd_h1_offload_test.cpp
)

if(WIN32)
    target_link_libraries (httpd_h1_offload_test httppp-static ws2_32)
else()
    target_link_libraries (httpd_h1_offload_test httppp-static)
endif()

add_test(httpd_h1_offload_test httpd_h1_offload_test)

add_executable(httpd_h1_deferred_stream_test
    httpd_h1_deferred_stream_test.cpp
)

if(WIN32)
    target_link_libraries (httpd_h1_deferred_stream_test httppp-static ws2_32)
else()
    target_link_libraries (httpd_h1_deferred_stream_test httppp-static)
endif()

add_test(httpd_h1_deferred_stream_test httpd_h1_deferred_stream_test)

add_executable(httpd_h2_window_credit_race_test
    httpd_h2_window_credit_race_test.cpp
)

if(WIN32)
    target_link_libraries (httpd_h2_window_credit_race_test httppp-static ws2_32)
else()
    target_link_libraries (httpd_h2_window_credit_race_test httppp-static)
endif()

add_test(httpd_h2_window_credit_race_test httpd_h2_window_credit_race_test)

add_executable(httpd_h2_dispatch_overload_test
    httpd_h2_dispatch_overload_test.cpp
)

if(WIN32)
    target_link_libraries (httpd_h2_dispatch_overload_test httppp-static ws2_32)
else()
    target_link_libraries (httpd_h2_dispatch_overload_test httppp-static)
endif()

add_test(httpd_h2_dispatch_overload_test httpd_h2_dispatch_overload_test)

add_executable(httpd_h1_dispatch_overload_test
    httpd_h1_dispatch_overload_test.cpp
)

if(WIN32)
    target_link_libraries (httpd_h1_dispatch_overload_test httppp-static ws2_32)
else()
    target_link_libraries (httpd_h1_dispatch_overload_test httppp-static)
endif()

add_test(httpd_h1_dispatch_overload_test httpd_h1_dispatch_overload_test)

add_executable(url_test
    url.cpp
)

if(WIN32)
    target_link_libraries (url_test httppp-static ws2_32)
else()
    target_link_libraries (url_test httppp-static)
endif()

add_executable(client_test
    client.cpp
)

if(WIN32)
    target_link_libraries (client_test httppp-static ws2_32)
else()
    target_link_libraries (client_test httppp-static)
endif()

add_executable(http1_checksum_test
    http1_checksum_test.cpp
)

if(WIN32)
    target_link_libraries (http1_checksum_test httppp-static ws2_32)
else()
    target_link_libraries (http1_checksum_test httppp-static)
endif()

add_test(http1_checksum_test http1_checksum_test)

add_executable(http1_nonblocking_stream_test
    http1_nonblocking_stream_test.cpp
)

if(WIN32)
    target_link_libraries (http1_nonblocking_stream_test httppp-static ws2_32)
else()
    target_link_libraries (http1_nonblocking_stream_test httppp-static)
endif()

add_test(http1_nonblocking_stream_test http1_nonblocking_stream_test)

add_executable(http2_checksum_test
    http2_checksum_test.cpp
)

if(WIN32)
    target_link_libraries (http2_checksum_test httppp-static ws2_32)
else()
    target_link_libraries (http2_checksum_test httppp-static)
endif()

add_test(http2_checksum_test http2_checksum_test)

add_executable(http3_checksum_test
    http3_checksum_test.cpp
)

if(WIN32)
    target_link_libraries (http3_checksum_test httppp-static ws2_32)
else()
    target_link_libraries (http3_checksum_test httppp-static)
endif()

add_test(http3_checksum_test http3_checksum_test)

add_executable(http3_control_streams_test
    http3_control_streams_test.cpp
)

if(WIN32)
    target_link_libraries (http3_control_streams_test httppp-static ws2_32)
else()
    target_link_libraries (http3_control_streams_test httppp-static)
endif()

add_test(http3_control_streams_test http3_control_streams_test)

add_executable(httpcompression_test
    httpcompression_test.cpp
)

if(WIN32)
    target_link_libraries (httpcompression_test httppp-static ws2_32)
else()
    target_link_libraries (httpcompression_test httppp-static)
endif()

add_test(httpcompression_test httpcompression_test)

add_executable(http_cookie_headers_test
    http_cookie_headers_test.cpp
)

if(WIN32)
    target_link_libraries (http_cookie_headers_test httppp-static ws2_32)
else()
    target_link_libraries (http_cookie_headers_test httppp-static)
endif()

add_test(http_cookie_headers_test http_cookie_headers_test)

add_executable(http_useragent_header_test
    http_useragent_header_test.cpp
)

if(WIN32)
    target_link_libraries (http_useragent_header_test httppp-static ws2_32)
else()
    target_link_libraries (http_useragent_header_test httppp-static)
endif()

add_test(http_useragent_header_test http_useragent_header_test)

add_executable(httpd_h2_peer_address_test
    httpd_h2_peer_address_test.cpp
)

if(WIN32)
    target_link_libraries (httpd_h2_peer_address_test httppp-static ws2_32)
else()
    target_link_libraries (httpd_h2_peer_address_test httppp-static)
endif()

add_test(httpd_h2_peer_address_test httpd_h2_peer_address_test)

add_executable(httpd_connection_handoff_test
    httpd_connection_handoff_test.cpp
)

if(WIN32)
    target_link_libraries (httpd_connection_handoff_test httppp-static ws2_32)
else()
    target_link_libraries (httpd_connection_handoff_test httppp-static)
endif()

add_test(httpd_connection_handoff_test httpd_connection_handoff_test)
