2022-01-29 17:14:15 +01:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
|
|
|
|
|
|
|
project(helpers_test)
|
|
|
|
set(TEST_CATEGORY Helpers)
|
|
|
|
|
|
|
|
# Add new tests here #
|
|
|
|
set(AVAILABLE_TESTS
|
|
|
|
# Common
|
|
|
|
TestSucceeding
|
|
|
|
TestFailing
|
|
|
|
TestProvider_read
|
|
|
|
TestProvider_write
|
|
|
|
|
|
|
|
# File
|
|
|
|
FileAccess
|
|
|
|
|
|
|
|
# Utils
|
|
|
|
SplitStringAtChar
|
|
|
|
SplitStringAtString
|
|
|
|
ExtractBits
|
|
|
|
)
|
|
|
|
|
2023-12-04 20:01:58 +01:00
|
|
|
if (NOT IMHEX_OFFLINE_BUILD)
|
|
|
|
set(AVAILABLE_TESTS ${AVAILABLE_TESTS}
|
|
|
|
# Net
|
|
|
|
StoreAPI
|
|
|
|
TipsAPI
|
|
|
|
ContentAPI
|
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
|
2022-01-29 17:14:15 +01:00
|
|
|
|
|
|
|
add_executable(${PROJECT_NAME}
|
|
|
|
source/common.cpp
|
|
|
|
source/file.cpp
|
|
|
|
source/net.cpp
|
|
|
|
source/utils.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# ---- No need to change anything from here downwards unless you know what you're doing ---- #
|
|
|
|
|
|
|
|
target_include_directories(${PROJECT_NAME} PRIVATE include)
|
2023-01-04 14:03:09 +01:00
|
|
|
target_link_libraries(${PROJECT_NAME} PRIVATE libimhex tests_common ${FMT_LIBRARIES})
|
2022-01-29 17:14:15 +01:00
|
|
|
|
|
|
|
set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
|
|
|
|
|
|
|
foreach (test IN LISTS AVAILABLE_TESTS)
|
|
|
|
add_test(NAME "${TEST_CATEGORY}/${test}" COMMAND ${PROJECT_NAME} "${test}" WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
|
|
|
endforeach ()
|
2023-05-20 13:37:57 +02:00
|
|
|
add_dependencies(unit_tests ${PROJECT_NAME})
|