Skip to content

Commit f991bbd

Browse files
committed
cmake: add unittests to ctest
1 parent d11f8ce commit f991bbd

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ if (BUILD_GIMP_GPL)
8181
set(GIMP_PALETTE_DIR ${CMAKE_INSTALL_DATADIR}/gimp/2.0/palettes CACHE STRING "Directory to place GIMP palettes")
8282
endif()
8383

84+
if (BUILD_TESTS)
85+
enable_testing()
86+
endif()
87+
8488
# External
8589
option(SYSTEM_NBTP "Use system nbtp" ON)
8690
if (${SYSTEM_NBTP})

src/CMakeLists.txt

+12
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,15 @@ foreach (PROGRAM IN LISTS PROGRAMS)
6565
endforeach ()
6666

6767
add_subdirectory(tests)
68+
69+
if (BUILD_TESTS)
70+
find_package(Python3 COMPONENTS Interpreter REQUIRED)
71+
file(GLOB TEST_FIXURES LIST_DIRECTORIES false "${CMAKE_CURRENT_SOURCE_DIR}/../test-images/*.json")
72+
foreach(TEST_FIXURE IN LISTS TEST_FIXURES)
73+
if ("${TEST_FIXURE}" MATCHES "([^/]+)\\.json")
74+
add_test(NAME "${CMAKE_MATCH_1}"
75+
COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../test-images/verify.py" "$<TARGET_FILE:minemap>" "${TEST_FIXURE}"
76+
)
77+
endif ()
78+
endforeach()
79+
endif ()

0 commit comments

Comments
 (0)