2021-09-11 14:41:18 +02:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
|
|
|
|
2021-09-11 18:09:15 +02:00
|
|
|
project(unit_tests)
|
2021-09-11 14:41:18 +02:00
|
|
|
|
|
|
|
|
|
|
|
# Add new tests here #
|
|
|
|
set(AVAILABLE_TESTS
|
|
|
|
Placement
|
2021-09-11 23:13:49 +02:00
|
|
|
Structs
|
|
|
|
Unions
|
|
|
|
Enums
|
|
|
|
Literals
|
|
|
|
Padding
|
|
|
|
SucceedingAssert
|
|
|
|
FailingAssert
|
2021-09-11 14:41:18 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-09-11 23:13:49 +02:00
|
|
|
add_executable(unit_tests source/main.cpp source/tests.cpp)
|
2021-09-11 18:09:15 +02:00
|
|
|
target_include_directories(unit_tests PRIVATE include)
|
|
|
|
target_link_libraries(unit_tests libimhex)
|
|
|
|
|
|
|
|
set_target_properties(unit_tests PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
|
|
|
|
|
|
|
add_custom_command(TARGET unit_tests
|
2021-09-11 14:41:18 +02:00
|
|
|
POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/test_data" ${CMAKE_BINARY_DIR})
|
|
|
|
|
|
|
|
foreach (test IN LISTS AVAILABLE_TESTS)
|
2021-09-11 18:09:15 +02:00
|
|
|
add_test(NAME "${test}" COMMAND unit_tests "${test}" WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
|
2021-09-11 14:41:18 +02:00
|
|
|
endforeach ()
|