############################################################################### option (TESTS "enable unit testing" ON) if (TESTS) include(CTest) enable_testing() list ( APPEND TEST_BIN ascii algo/search algo/sort alloc/aligned/foreign alloc/aligned/direct alloc/easy alloc/linear alloc/stack affine array/darray array/sarray array/parray backtrace bezier bitwise bool buffer/simple cmdopt cmdopt2 colour concepts comparator coord debug/fpe encode/number encode/base endian exe expected extent fixed float format/quoted fs/scoped fs/tmp geom/aabb geom/ellipse geom/frustum geom/line geom/plane geom/ray geom/sample/edge geom/sample/subregion geom/segment geom/sphere hash/buzhash hash/checksum hash/crc hash/fasthash hash/fnv1a hash/halfsipmix hash/murmur hash/siphash hash/table hash/tuple hash/xxhash hton io introspection introspection/enum_simple iterator job/dispatch job/queue kmeans list/sort map/fixed map/multi_fixed maths maths/fast matrix memory/deleter parallel/queue parallel/stack parse/enum parse/value parse/time parse/si paths point polynomial pool preprocessor quaternion rand/buckets rand/generator/normal random range rational region registrar roots/bisection scoped serialise set/dset signal singleton stream string stringid stringcache strongdef thread/event thread/flag thread/monitor thread/semaphore thread/spinlock thread/ticketlock time/8601 traits tuple/index tuple/value tuple/type typeidx types/description types/tagged uri utf8 vector version view ) if (NOT WIN32) list (APPEND TEST_BIN buffer/circular buffer/paged ) endif () if (SIMD) list (APPEND TEST_BIN coord/simd ) endif() add_custom_target(util_test) foreach(t ${TEST_BIN}) string(REPLACE "/" "_" name "test/${t}") add_executable(util_${name} "${t}.cpp") target_link_libraries(util_${name} PRIVATE cruft::util) #target_include_directories(util_${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(util_${name} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/prefix/${PREFIX}") add_test(NAME util_${name} COMMAND util_${name}) set_tests_properties(util_${name} PROPERTIES FAIL_REGULAR_EXPRESSION "not ok -") add_dependencies(util_test util_${name}) endforeach(t) configure_file (cpp.py.in util_test_cpp.py @ONLY) add_test (NAME util_test_cpp COMMAND ${Python3_EXECUTABLE} util_test_cpp.py) set_property (TEST util_test_cpp APPEND PROPERTY DEPENDS util_macro) set_tests_properties(util_test_cpp PROPERTIES FAIL_REGULAR_EXPRESSION "not ok -") endif ()