Tests: add live integration test (optional via PRIVATEBIN_IT), fix WinHTTP host/port + TLS opts, robust JSON parser (meta.time_to_live), CTest wiring; Add LLVM/clang-cl coverage option and docs; add build_thinkpad.bat; README updates

This commit is contained in:
mbusc
2025-08-28 15:22:00 +02:00
parent 7a125a4c9c
commit 0f58d40f52
10 changed files with 467 additions and 39 deletions

View File

@@ -3,23 +3,26 @@ project(PrivateBinAPITests)
set(CMAKE_CXX_STANDARD 17)
# Find the privatebinapi library
find_library(PRIVATEBINAPI_LIB privatebinapi
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/../build)
# If not found, build it as part of the project
if(NOT PRIVATEBINAPI_LIB)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR}/privatebinapi)
set(PRIVATEBINAPI_LIB privatebinapi)
endif()
# Create test executable
add_executable(test_basic test_basic.cpp)
# Link with the privatebinapi library
target_link_libraries(test_basic ${PRIVATEBINAPI_LIB})
# Link with the already-defined privatebinapi target from the root project
target_link_libraries(test_basic PRIVATE privatebinapi)
# Ensure the DLL is available next to the test executable on Windows
if(WIN32)
add_dependencies(test_basic privatebinapi)
add_custom_command(TARGET test_basic POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:privatebinapi>
$<TARGET_FILE_DIR:test_basic>
)
endif()
# Include directories
target_include_directories(test_basic PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../include
)
)
# Register the test with CTest
add_test(NAME test_basic COMMAND test_basic)