From 269feff7e186f0876db2561c2c502ba39dac4a81 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Sat, 13 Aug 2016 15:44:11 +0200 Subject: [PATCH 01/14] Handle .cin files correctly, with a CMake script in process mode Handle also multi-line `.cmd` files. --- .../CGAL_CreateSingleSourceCGALProgram.cmake | 24 ++++++++++++------- .../cmake/modules/run_test_with_cin.cmake | 19 +++++++++++++++ 2 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 Installation/cmake/modules/run_test_with_cin.cmake diff --git a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake index 8549d00dd9a..2ce4cea319e 100644 --- a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake +++ b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake @@ -20,16 +20,22 @@ function(create_single_source_cgal_program firstfile ) if(BUILD_TESTING) if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cin") - set(ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cin") - elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cmd") - file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cmd" ARGS LIMIT_COUNT 1) - # TODO: handle multi-lines .cmd files - # see https://github.com/CGAL/cgal/pull/1295/files/c65d3abe17bb3e677b8077996cdaf8672f9c4c6f#r71705451 + add_test(NAME ${exe_name} + COMMAND ${CMAKE_COMMAND} + -DCMD:STRING=$ + -DCIN:STRING=${exe_name}.cin + -P ${CGAL_MODULES_DIR}/run_test_with_cin.cmake + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + message(STATUS "add test: ${exe_name} < ${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cin") + else() + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cmd") + file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cmd" ARGS) + endif() + message(STATUS "add test: ${exe_name} ${ARGS}") + add_test(NAME ${exe_name} + COMMAND ${exe_name} ${ARGS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) endif() - message(STATUS "add test for ${exe_name}") - add_test(NAME ${exe_name} - COMMAND ${exe_name} ${ARGS} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) set_property(TEST "${exe_name}" APPEND PROPERTY LABELS "${PROJECT_NAME}") endif(BUILD_TESTING) diff --git a/Installation/cmake/modules/run_test_with_cin.cmake b/Installation/cmake/modules/run_test_with_cin.cmake new file mode 100644 index 00000000000..c5218fc8141 --- /dev/null +++ b/Installation/cmake/modules/run_test_with_cin.cmake @@ -0,0 +1,19 @@ +if(NOT CMD OR NOT EXISTS ${CMD}) + message(FATAL_ERROR + "The variable `CMD` should be defined to the test program to run!") +endif() + +if(NOT CIN OR NOT EXISTS ${CIN}) + message(FATAL_ERROR + "The variable `CIN` should be defined to the input file for the test!") +endif() + +execute_process( + COMMAND ${CMD} + INPUT_FILE ${CIN} + RESULT_VARIABLE error_result) + +if(error_result) + message(SEND_ERROR + "The test `${CMD} < ${CIN}` ended with the error code ${error_result}.") +endif() From 37e138b2529ac50ede8247b25f31cec24b9a56b1 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Sat, 13 Aug 2016 15:44:34 +0200 Subject: [PATCH 02/14] CTest in branch builds --- CMakeLists.txt | 5 +++++ Installation/CMakeLists.txt | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e53ea8f824..0e0e9c03b20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,11 @@ include(${CMAKE_SOURCE_DIR}/Installation/cmake/modules/CGAL_SCM.cmake) option( CGAL_REPORT_DUPLICATE_FILES "Switch on to start (naive) detection of duplicate source- and headerfiles in packages" OFF) message( "== CMake setup (DONE) ==\n" ) + +# Enable testing with BUILD_TESTING +option(BUILD_TESTING "Build the testing tree." OFF) +include(CTest) + # and finally start actual build add_subdirectory( Installation ) add_subdirectory( Documentation/doc) diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index 0058828a7e5..b05a922a051 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -130,6 +130,10 @@ else ( CGAL_BRANCH_BUILD ) set(CGAL_CORE_PACKAGE_DIR "${CMAKE_SOURCE_DIR}" CACHE INTERNAL "Directory containing the Core package") set(CGAL_GRAPHICSVIEW_PACKAGE_DIR "${CMAKE_SOURCE_DIR}" CACHE INTERNAL "Directory containing the GraphicsView package") + # Enable testing with BUILD_TESTING + option(BUILD_TESTING "Build the testing tree." OFF) + include(CTest) + endif (CGAL_BRANCH_BUILD ) #message(STATUS "Packages found: ${CGAL_CONFIGURED_PACKAGES}") @@ -776,10 +780,6 @@ message("== Write compiler_config.h (DONE) ==\n") #-------------------------------------------------------------------------------------------------- -# Enable testing with BUILD_TESTING -option(BUILD_TESTING "Build the testing tree." OFF) -include(CTest) - message("== Generating build files ==") set(CGAL_LIBRARIES_DIR ${CMAKE_BINARY_DIR}/lib) From 0f1999f1bfb128341a3fcb1f98f939a4dc62ae4c Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Sat, 13 Aug 2016 21:54:02 +0200 Subject: [PATCH 03/14] Add a test that will fail With the `WILL_FAIL` property, ctest will make the test success if it fails. The `cgal_test` script will not run it, because the file `will_fail.cpp` does not contain a `main` function. --- Installation/test/Installation/CMakeLists.txt | 5 +++++ Installation/test/Installation/will_fail.cpp | 5 +++++ Installation/test/Installation/will_fail_aux.cpp | 2 ++ 3 files changed, 12 insertions(+) create mode 100644 Installation/test/Installation/will_fail.cpp create mode 100644 Installation/test/Installation/will_fail_aux.cpp diff --git a/Installation/test/Installation/CMakeLists.txt b/Installation/test/Installation/CMakeLists.txt index 0512386bfbd..8d23065d0da 100644 --- a/Installation/test/Installation/CMakeLists.txt +++ b/Installation/test/Installation/CMakeLists.txt @@ -40,6 +40,11 @@ if ( CGAL_FOUND ) create_single_source_cgal_program( "test_use_h.cpp" ) + create_single_source_cgal_program( will_fail.cpp will_fail_aux.cpp ) + if(BUILD_TESTING) + set_property(TEST will_fail PROPERTY WILL_FAIL TRUE) + endif() + find_package( TBB QUIET ) if( TBB_FOUND ) include(${TBB_USE_FILE}) diff --git a/Installation/test/Installation/will_fail.cpp b/Installation/test/Installation/will_fail.cpp new file mode 100644 index 00000000000..1ae6cb4c591 --- /dev/null +++ b/Installation/test/Installation/will_fail.cpp @@ -0,0 +1,5 @@ +#include + +int f() { + return EXIT_FAILURE; +} diff --git a/Installation/test/Installation/will_fail_aux.cpp b/Installation/test/Installation/will_fail_aux.cpp new file mode 100644 index 00000000000..f999acead77 --- /dev/null +++ b/Installation/test/Installation/will_fail_aux.cpp @@ -0,0 +1,2 @@ +extern int f(); +int main() { return f(); } From c30560143b931f88bba4b6a3df2b1ead2e154843 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 17 Aug 2016 16:15:17 +0200 Subject: [PATCH 04/14] Correctly handle `.cmd` files The trick to use the CMake command `separate_arguments` to interpret the lines of the `.cmd` file. --- .../CGAL_CreateSingleSourceCGALProgram.cmake | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake index 2ce4cea319e..58b5bd6e384 100644 --- a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake +++ b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake @@ -19,25 +19,36 @@ function(create_single_source_cgal_program firstfile ) add_executable(${exe_name} ${all}) if(BUILD_TESTING) - if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cin") + set(cin_file "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cin") + if(EXISTS ${cin_file}) add_test(NAME ${exe_name} COMMAND ${CMAKE_COMMAND} -DCMD:STRING=$ - -DCIN:STRING=${exe_name}.cin - -P ${CGAL_MODULES_DIR}/run_test_with_cin.cmake - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - message(STATUS "add test: ${exe_name} < ${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cin") + -DCIN:STRING=${cin_file} + -P "${CGAL_MODULES_DIR}/run_test_with_cin.cmake") +# message(STATUS "add test: ${exe_name} < ${cin_file}") else() - if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cmd") - file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cmd" ARGS) + # TODO: deal with shell globbing; if the `cmd` file contains + # a `*`, then interprete the command using bash. + set(cmd_file "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cmd") + if(EXISTS ${cmd_file}) + file(STRINGS "${cmd_file}" CMD_LINES) + set(ARGS) +# message(STATUS "DEBUG test ${exe_name}") + foreach(CMD_LINE ${CMD_LINES}) +# message(STATUS " command line: ${CMD_LINE}") + separate_arguments(CMD_LINE_ARGS UNIX_COMMAND ${CMD_LINE}) + # message(STATUS " args: ${CMD_LINE_ARGS}") + list(APPEND ARGS ${CMD_LINE_ARGS}) + endforeach() endif() - message(STATUS "add test: ${exe_name} ${ARGS}") - add_test(NAME ${exe_name} - COMMAND ${exe_name} ${ARGS} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) +# message(STATUS "add test: ${exe_name} ${ARGS}") + add_test(NAME ${exe_name} COMMAND ${exe_name} ${ARGS}) endif() set_property(TEST "${exe_name}" APPEND PROPERTY LABELS "${PROJECT_NAME}") + set_property(TEST "${exe_name}" + PROPERTY WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) endif(BUILD_TESTING) add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${exe_name} ) From 545e80f18e126826a3c77866293b4df270802cd3 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Tue, 23 Aug 2016 14:25:53 +0200 Subject: [PATCH 05/14] Add a variable CGAL_CURRENT_SOURCE_DIR Save the current source directory to `CGAL_CURRENT_SOURCE_DIR`. The variable value is modified by a `CMakeLists.txt` file when it is generated by `cgal_create_cmake_script` in the binary tree. The script `cgal_create_cmake_script` itself it called by CMake, by the function `process_CGAL_subdirectory` (see its definition in `Installation/cmake/modules/CGAL_Macros.cmake`), called in `(examples|test|demo)/CMakeLists.txt`. Eventually, that variable value is supposed to be the directory to the current sources, even if the current `CMakeLists.txt` is within the binary tree. That is used in `CGAL_CreateSingleSourceCGALProgram.cmake` for the CTest support, so set correctly the current working directory (in the directory of the tests/examples). --- .../CGAL_CreateSingleSourceCGALProgram.cmake | 13 +++++++------ Installation/cmake/modules/UseCGAL.cmake | 5 +++++ Scripts/scripts/cgal_create_cmake_script | 4 ++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake index 58b5bd6e384..281b513764b 100644 --- a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake +++ b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake @@ -1,7 +1,7 @@ function(create_single_source_cgal_program firstfile ) if(NOT IS_ABSOLUTE "${firstfile}") - set(firstfile "${CMAKE_CURRENT_SOURCE_DIR}/${firstfile}") + set(firstfile "${CGAL_CURRENT_SOURCE_DIR}/${firstfile}") endif() get_filename_component(exe_name ${firstfile} NAME_WE) @@ -12,14 +12,14 @@ function(create_single_source_cgal_program firstfile ) # remaining files foreach( i ${ARGN} ) - set( all ${all} ${CMAKE_CURRENT_SOURCE_DIR}/${i} ) + set( all ${all} ${CGAL_CURRENT_SOURCE_DIR}/${i} ) endforeach() add_executable(${exe_name} ${all}) if(BUILD_TESTING) - set(cin_file "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cin") + set(cin_file "${CGAL_CURRENT_SOURCE_DIR}/${exe_name}.cin") if(EXISTS ${cin_file}) add_test(NAME ${exe_name} COMMAND ${CMAKE_COMMAND} @@ -30,7 +30,7 @@ function(create_single_source_cgal_program firstfile ) else() # TODO: deal with shell globbing; if the `cmd` file contains # a `*`, then interprete the command using bash. - set(cmd_file "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cmd") + set(cmd_file "${CGAL_CURRENT_SOURCE_DIR}/${exe_name}.cmd") if(EXISTS ${cmd_file}) file(STRINGS "${cmd_file}" CMD_LINES) set(ARGS) @@ -38,7 +38,7 @@ function(create_single_source_cgal_program firstfile ) foreach(CMD_LINE ${CMD_LINES}) # message(STATUS " command line: ${CMD_LINE}") separate_arguments(CMD_LINE_ARGS UNIX_COMMAND ${CMD_LINE}) - # message(STATUS " args: ${CMD_LINE_ARGS}") +# message(STATUS " args: ${CMD_LINE_ARGS}") list(APPEND ARGS ${CMD_LINE_ARGS}) endforeach() endif() @@ -47,8 +47,9 @@ function(create_single_source_cgal_program firstfile ) endif() set_property(TEST "${exe_name}" APPEND PROPERTY LABELS "${PROJECT_NAME}") +# message(STATUS " workding dir: ${CGAL_CURRENT_SOURCE_DIR}") set_property(TEST "${exe_name}" - PROPERTY WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + PROPERTY WORKING_DIRECTORY ${CGAL_CURRENT_SOURCE_DIR}) endif(BUILD_TESTING) add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${exe_name} ) diff --git a/Installation/cmake/modules/UseCGAL.cmake b/Installation/cmake/modules/UseCGAL.cmake index 814d4bfbc06..259fb97b451 100644 --- a/Installation/cmake/modules/UseCGAL.cmake +++ b/Installation/cmake/modules/UseCGAL.cmake @@ -9,6 +9,11 @@ include(${CGAL_MODULES_DIR}/CGAL_Macros.cmake) cgal_setup_module_path() +# Save the current source directory. That variable can be changed by +# a `CMakeLists.txt`, for `CMakeLists.txt` files that are created in +# the binary directory. +set(CGAL_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + if(NOT USE_CGAL_FILE_INCLUDED) set(USE_CGAL_FILE_INCLUDED 1) diff --git a/Scripts/scripts/cgal_create_cmake_script b/Scripts/scripts/cgal_create_cmake_script index b39812fa1d7..d31102227d2 100755 --- a/Scripts/scripts/cgal_create_cmake_script +++ b/Scripts/scripts/cgal_create_cmake_script @@ -58,6 +58,10 @@ if ( CGAL_FOUND ) include( CGAL_CreateSingleSourceCGALProgram ) EOF + if [ -d "${SOURCE_DIR}" ] ; then + echo " set(CGAL_CURRENT_SOURCE_DIR \"${SOURCE_DIR}\")" + echo + fi if [ -d "${SOURCE_DIR}../../include" ] ; then echo " include_directories (BEFORE \"${SOURCE_DIR}../../include\")" echo From 0a88180b51ff56b21c57ba694166c921055f90f5 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Tue, 23 Aug 2016 14:34:54 +0200 Subject: [PATCH 06/14] Handle the case when a glob pattern is in .cmd In that case, CMake must use globbing to interpret the content of the .cmd file. --- .../CGAL_CreateSingleSourceCGALProgram.cmake | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake index 281b513764b..2cce6012790 100644 --- a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake +++ b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake @@ -1,3 +1,24 @@ +function(expand_list_with_globbing list_name) + set(input_list ${${list_name}}) +# message(STATUS "expand_list_with_globbing(${list_name}), ${list_name} is: ${input_list}") + list(LENGTH input_list list_lenght) + math(EXPR list_last_n "${list_lenght} - 1") + set(output_list) + foreach(n RANGE ${list_last_n}) +# message(STATUS "n=${n}") + list(GET input_list ${n} item_n) +# message(STATUS "argument ${n} is ${item_n}") + if(item_n MATCHES ".*\\*.*") + file(GLOB files RELATIVE ${CGAL_CURRENT_SOURCE_DIR} ${item_n}) + list(APPEND output_list ${files}) + else() + list(APPEND output_list ${item_n}) + endif() +# message(STATUS " new value of the output list: ${output_list}") + endforeach() + set(${list_name} ${output_list} PARENT_SCOPE) +endfunction() + function(create_single_source_cgal_program firstfile ) if(NOT IS_ABSOLUTE "${firstfile}") @@ -41,6 +62,7 @@ function(create_single_source_cgal_program firstfile ) # message(STATUS " args: ${CMD_LINE_ARGS}") list(APPEND ARGS ${CMD_LINE_ARGS}) endforeach() + expand_list_with_globbing(ARGS) endif() # message(STATUS "add test: ${exe_name} ${ARGS}") add_test(NAME ${exe_name} COMMAND ${exe_name} ${ARGS}) From c0f36af4427531f8e05792191f3c32a5138c5810 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Tue, 23 Aug 2016 15:45:49 +0200 Subject: [PATCH 07/14] Add a comment --- .../CGAL_CreateSingleSourceCGALProgram.cmake | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake index 2cce6012790..dd95a97269f 100644 --- a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake +++ b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake @@ -1,3 +1,24 @@ + +# Process a list, and replace items contains a file pattern (like +# `*.off`) by the sublist that corresponds to the globbing of the +# pattern in the directory `${CGAL_CURRENT_SOURCE_DIR}`. +# +# +# For example: the `file +# test/Poisson_surface_reconstruction_3/poisson_reconstruction_test.cmd` +# contains: +# +# data/*.off data/*.xyz data/*.pwn +# +# For that file, the list `ARGS` computed in the function +# `create_single_source_cgal_program` (see below) is the list: +# +# data/*.off;data/*.xyz;data/*.pwn +# +# A call to `expand_list_with_globbing(ARGS)` replaces the list by: +# +# data/ChineseDragon-10kv.off;data/robocat_deci.off;data/sphere_20k.xyz;data/oni.pwn" +# function(expand_list_with_globbing list_name) set(input_list ${${list_name}}) # message(STATUS "expand_list_with_globbing(${list_name}), ${list_name} is: ${input_list}") From 3d36fe05b3ca13d11b2b46afd1c89d64a9f0a32e Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 7 Sep 2016 16:14:00 +0200 Subject: [PATCH 08/14] WIP: the Arr_2 testsuite is now working!! --- .../Arrangement_on_surface_2/CMakeLists.txt | 11 +- .../Arrangement_on_surface_2/cgal_test.cmake | 1555 +++++++++++++++++ .../CGAL_CreateSingleSourceCGALProgram.cmake | 37 +- .../cmake/modules/CGAL_add_test.cmake | 110 ++ 4 files changed, 1675 insertions(+), 38 deletions(-) create mode 100644 Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake create mode 100644 Installation/cmake/modules/CGAL_add_test.cmake diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/CMakeLists.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/CMakeLists.txt index 1825ea2c757..5970c563d22 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/CMakeLists.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/CMakeLists.txt @@ -4,6 +4,8 @@ project( Arrangement_on_surface_2_ ) +enable_testing() + cmake_minimum_required(VERSION 2.8.10) find_package(CGAL QUIET COMPONENTS Core) @@ -16,11 +18,12 @@ if ( CGAL_FOUND ) include_directories (BEFORE "../../include") + include( ${CMAKE_CURRENT_SOURCE_DIR}/cgal_test.cmake ) # create a target per cppfile - file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) - foreach(cppfile ${cppfiles}) - create_single_source_cgal_program( "${cppfile}" ) - endforeach() +# file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) +# foreach(cppfile ${cppfiles}) +# create_single_source_cgal_program( "${cppfile}" ) +# endforeach() else() diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake new file mode 100644 index 00000000000..1e849088932 --- /dev/null +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake @@ -0,0 +1,1555 @@ +#! /bin/bash + +# This is a script for the CGAL test suite. Such a script must obey +# the following rules: +# +# - the name of the script is cgal_test +# - for every target two one line messages are written to the file 'error.txt' +# the first one indicates if the compilation was successful +# the second one indicates if the execution was successful +# if one of the two was not successful, the line should start with 'ERROR:' +# - running the script should not require any user interaction +# - the script should clean up object files and executables + +# SET PARAMETERS FOR cgal_test + +include(CGAL_add_test) + +function(cgal_debug_message) +# message(${ARGN}) +endfunction() + +set(ERRORFILE error.txt) +set(DO_RUN y) + +set(FULL_ERROR_DESCRIPTION_FILE ProgramOutput.error.txt) + +#---------------------------------------------------------------------# +# compile_and_run +#---------------------------------------------------------------------# + +# note that these values shloud match to the values in test_configuration.h file + +set(CARTESIAN_KERNEL 0) +set(SIMPLE_CARTESIAN_KERNEL 1) +set(UNIVARIATE_ALGEBRAIC_KERNEL 2) + +set(SEGMENT_GEOM_TRAITS 0) +set(NON_CACHING_SEGMENT_GEOM_TRAITS 1) +set(POLYLINE_GEOM_TRAITS 2) +set(NON_CACHING_POLYLINE_GEOM_TRAITS 3) +set(POLYCURVE_CONIC_GEOM_TRAITS 14) +set(POLYCURVE_CIRCULAR_ARC_GEOM_TRAITS 15) +set(POLYCURVE_BEZIER_GEOM_TRAITS 16) +set(LINEAR_GEOM_TRAITS 4) +set(CORE_CONIC_GEOM_TRAITS 5) +set(LINE_ARC_GEOM_TRAITS 6) +set(CIRCULAR_ARC_GEOM_TRAITS 7) +set(CIRCULAR_LINE_ARC_GEOM_TRAITS 8) +set(CIRCLE_SEGMENT_GEOM_TRAITS 9) +set(BEZIER_GEOM_TRAITS 10) +set(GEODESIC_ARC_ON_SPHERE_GEOM_TRAITS 11) +set(RATIONAL_ARC_GEOM_TRAITS 12) +set(ALGEBRAIC_GEOM_TRAITS 13) +set(POLYCURVE_CONIC_GEOM_TRAITS 14) +set(POLYCURVE_CIRCULAR_ARC_GEOM_TRAITS 15) +set(POLYCURVE_BEZIER_GEOM_TRAITS 16) +set(FLAT_TORUS_GEOM_TRAITS 17) + +set(PLANAR_BOUNDED_TOPOL_TRAITS 0) +set(PLANAR_UNBOUNDED_TOPOL_TRAITS 1) +set(SPHERICAL_TOPOL_TRAITS 2) + +set(DOUBLE_NT 0) +set(MP_FLOAT_NT 1) +set(GMPZ_NT 2) +set(LEDA_RAT_NT 3) +set(QUOTIENT_MP_FLOAT_NT 4) +set(QUOTIENT_CGAL_GMPZ_NT 5) +set(CGAL_GMPQ_NT 6) +set(LAZY_LEDA_RAT_NT 7) +set(LAZY_CGAL_GMPQ_NT 8) +set(LAZY_QUOTIENT_MP_FLOAT_NT 9) +set(LEDA_REAL_NT 10) +set(CORE_EXPR_NT 11) +set(LAZY_GMPZ_NT 12) +set(LEDA_INT_NT 13) +set(CGAL_GMPZ_NT 14) +set(CORE_INT_NT 15) +set(CORE_RAT_NT 16) + +if($ENV{CGAL_DISABLE_GMP}) + message(STATUS "GMP is disable. Try to use LEDA instead.") + set(GMPZ_NT ${LEDA_INT_NT}) + set(QUOTIENT_CGAL_GMPZ_NT ${LEDA_RAT_NT}) + set(CGAL_GMPQ_NT ${LEDA_RAT_NT}) + set(LAZY_CGAL_GMPQ_NT ${LAZY_LEDA_RAT_NT}) + set(LAZY_GMPZ_NT ${LAZY_LEDA_RAT_NT}) + set(CGAL_GMPZ_NT ${LEDA_INT_NT}) +endif() + +set(COMPARE 1) +set(VERTEX 2) +set(IS_VERTICAL 3) +set(COMPARE_Y_AT_X 4) +set(COMPARE_Y_AT_X_LEFT 5) +set(COMPARE_Y_AT_X_RIGHT 6) +set(MAKE_X_MONOTONE 7) +set(INTERSECT 8) +set(SPLIT 9) +set(ARE_MERGEABLE 10) +set(MERGE 11) +set(ASSERTIONS 12) +set(CONSTRUCTOR 13) +set(COMPARE_X_AT_LIMIT 14) +set(COMPARE_X_NEAR_LIMIT 15) +set(COMPARE_X_ON_BOUNDARY 16) +set(COMPARE_X_NEAR_BOUNDARY 17) +set(COMPARE_Y_NEAR_BOUNDARY 18) +set(PARAMETER_SPACE_X 19) +set(PARAMETER_SPACE_Y 20) +set(X_ON_IDENTIFICATION 21) +set(Y_ON_IDENTIFICATION 22) +set(IS_BOUNDED 23) +set(IS_IN_X_RANGE 24) +set(COMPARE_Y_POSITION 25) +set(IS_BETWEEN_CW 26) +set(COMPARE_CW_AROUND_POINT 27) +set(PUSH_BACK 28) +set(PUSH_FRONT 29) +set(NUMBER_OF_POINTS 32) +set(COMPARE_ENDPOINTS_XY 33) +set(CONSTRUCT_OPPOSITE 34) +set(TRIM 35) + +#---------------------------------------------------------------------# +# configure +#---------------------------------------------------------------------# + +function(configure) + cgal_debug_message(STATUS "---> cmake with -DCGAL_CXX_FLAGS:STRING=\"${TESTSUITE_CXXFLAGS}\"") + string(REPLACE "-DTEST_" "" suffix "${TESTSUITE_CXXFLAGS}") + string(REPLACE "KERNEL" "K" suffix "${suffix}") + string(REPLACE "GEOM_TRAITS" "GT" suffix "${suffix}") + string(REPLACE "-DCGAL_ARR_POINT_LOCATION" "POINT_LOCATION" suffix "${suffix}") + string(MAKE_C_IDENTIFIER "${suffix}" suffix) + cgal_debug_message(STATUS " suffix: ${suffix}") + set(suffix ${suffix} PARENT_SCOPE) +# if eval 'cmake "${CMAKE_GENERATOR}" -DRUNNING_CGAL_AUTO_TEST=TRUE \ +# -DCGAL_DIR="${CGAL_DIR}" \ +# -DCGAL_CXX_FLAGS:STRING="${TESTSUITE_CXXFLAGS} -I../../include" \ +# -DCGAL_EXE_LINKER_FLAGS="${TESTSUITE_LDFLAGS}" \ +# -DCMAKE_BUILD_TYPE=NOTFOUND \ +# .' ; then +# +# echo " successful configuration" >> ${ERRORFILE} +# else +# echo " ERROR: configuration" >> ${ERRORFILE} +# fi +endfunction() + +function(compile_test_with_flags name type flags) + cgal_debug_message(STATUS "# compile_test_with_flags(${name} ${type} \"${flags}\" ${ARGN})") + set(TESTSUITE_CXXFLAGS "${flags}") + set(TESTSUITE_CXXFLAGS "${flags}" PARENT_SCOPE) +# message(" successful configuration") +# message(" successful compilation of ${name} ${type}") + configure() + set(suffix ${suffix} PARENT_SCOPE) +# set(suffix ${type}) + cgal_arr_2_add_target(${name} ${name}.cpp) +# if eval '${MAKE_CMD} VERBOSE=1 -fMakefile \ +# ${name}' ; then +# echo " successful compilation of ${name} ${type}" >> ${ERRORFILE}; +# set(SUCCESS "y") +# else +# echo " ERROR: compilation of ${name} ${type}" >> ${ERRORFILE}; +# set(SUCCESS "") +# fi +endfunction() + +function(cgal_arr_2_add_target exe_name source_file) + cgal_debug_message(STATUS "# cgal_arr_2_add_target(${ARGN})") + if(suffix) + set(name ${exe_name}_${suffix}) + endif() + add_executable(${name} ${source_file}) + separate_arguments(flags UNIX_COMMAND "${TESTSUITE_CXXFLAGS}") + target_compile_options(${name} PRIVATE ${flags}) + cgal_debug_message(STATUS "# -> target ${name} with TESTSUITE_CXXFLAGS: ${flags}") +endfunction() + +function(run_test name) + # ${ARGV0} - executable name + cgal_debug_message(STATUS "# run_test(${ARGN})") + cgal_arr_2_add_target(${name} ${ARGN}) +# basedata=`basename "${5}"` +# OUTPUTFILE="ProgramOutput.${ARGV0}" +# rm -f ${OUTPUTFILE} +# COMMAND="./${ARGV0}" +# if [ -f ${ARGV0}.cmd ] ; then +# COMMAND="${COMMAND} `cat ${ARGV0}.cmd`" +# fi +# if [ -f ${ARGV0}.cin ] ; then +# COMMAND="cat ${ARGV0}.cin | ${COMMAND}" +# fi +# OUTPUTFILE="${OUTPUTFILE}.${PLATFORM}" +# echo "Executing ${ARGV0} (${ARGV1}) ... " +# ulimit -t 3600 2> /dev/null +# if eval ${COMMAND} > ${OUTPUTFILE} 2>&1 ; then +# echo " successful execution of ${ARGV0}" >> ${ERRORFILE} +# else +# echo " ERROR: execution of ${ARGV0}" >> ${ERRORFILE} +# cat ${OUTPUTFILE} >> ${FULL_ERROR_DESCRIPTION_FILE} +# fi +endfunction() + +function(run_test_with_flags) + # ${ARGV0} - executable name + # ${ARGV1} - test substring name + cgal_debug_message(STATUS "# run_test_with_flags(${ARGN})") + cgal_add_test(${ARGV0}_${suffix} ${ARGV0} ${ARGV0}.${ARGV1}) +# basedata=`basename "${5}"` +# OUTPUTFILE="ProgramOutput.${ARGV0}" +# rm -f ${OUTPUTFILE} +# COMMAND="./${ARGV0}" +# if [ -f ${ARGV0}.cmd ] ; then +# COMMAND="${COMMAND} `cat ${ARGV0}.cmd`" +# elif [ -f ${ARGV0}.${ARGV1}.cmd ] ; then +# COMMAND="${COMMAND} `cat ${ARGV0}.${ARGV1}.cmd`" +# OUTPUTFILE=${OUTPUTFILE}.`echo ${ARGV1} | tr '/' '.'` +# fi +# if [ -f ${ARGV0}.cin ] ; then +# COMMAND="cat ${ARGV0}.cin | ${COMMAND}" +# elif [ -f ${ARGV0}.${ARGV1}.cin ] ; then +# COMMAND="cat ${ARGV0}.${ARGV1}.cin | ${COMMAND}" +# OUTPUTFILE=${OUTPUTFILE}.`echo ${ARGV1} | tr '/' '.'` +# fi +# OUTPUTFILE="${OUTPUTFILE}.${PLATFORM}" +# echo "Executing ${ARGV0} (${ARGV1}) ... " +# ulimit -t 3600 2> /dev/null +# if eval ${COMMAND} > ${OUTPUTFILE} 2>&1 ; then +# echo " successful execution of ${ARGV0} (${ARGV1})" >> ${ERRORFILE} +# else +# echo " ERROR: execution of ${ARGV0} (${ARGV1})" >> ${ERRORFILE} +# cat ${OUTPUTFILE} >> ${FULL_ERROR_DESCRIPTION_FILE} +# fi +endfunction() + +function(run_test_alt name datafile) + if(suffix) + set(name ${name}_${suffix}) + endif() + cgal_debug_message(STATUS "# run_test_alt(${ARGN})") + cgal_debug_message(STATUS "# -> ./${name} ${datafile} ${ARGN}") + if(new_structure) + set(infix " (NEW)") + elseif(old_structure) + set(infix " (OLD)") + else() + set(infix " ") + endif() + set(command ${name} ${datafile} ${ARGN}) + string(MAKE_C_IDENTIFIER "${name}${infix} ${ARGV4} ${ARGV5}" test_name) +# string(MAKE_C_IDENTIFIER "${command}" test_name) + add_test(NAME ${test_name} COMMAND ${command} + WORKING_DIRECTORY ${CGAL_CURRENT_SOURCE_DIR}) +# message(" successful execution of ${name}${infix} ${ARGV4} ${ARGV5}") + set_property(TEST "${test_name}" + APPEND PROPERTY LABELS "${PROJECT_NAME}") + cgal_debug_message(STATUS "add test \"${test_name}\": ${name} ${datafile} ${ARGN}") +# OUTPUTFILE=ProgramOutput.${ARGV0}.`echo ${5} | tr '/' '.'`.${6} +# #echo ****generating file ${OUTPUTFILE} +# # dirdata=`dirname "${datafile}"` +# rm -f ${OUTPUTFILE} +# COMMAND="./${ARGV0}" +# echo "Executing ${ARGV0} ${5} ${6} ... " +# if eval ${COMMAND} ${ARGV1} ${ARGV2} ${4} ${5} ${6} > ${OUTPUTFILE} 2>&1 ; then +# echo " successful execution of ${5} ${6}" >> ${ERRORFILE} +# else +# echo " ERROR: execution of ${5} ${6}" >> ${ERRORFILE} +# cat ${OUTPUTFILE} >> ${FULL_ERROR_DESCRIPTION_FILE} +# fi +endfunction() + +function(run_trapped_test name datafile) + cgal_debug_message(STATUS "# run_trapped_test(${name} ${datafile} ${ARGN})") + run_test_alt(${name} ${datafile} ${ARGN}) +endfunction() + +function(compile_and_run) + set(name ${ARGV0}) + cgal_debug_message(STATUS "# compile_and_run(${ARGN})") +# message(" successful compilation of ${name}") + cgal_arr_2_add_target(${name} ${name}.cpp) + cgal_add_test(${name}) +# if eval '${MAKE_CMD} VERBOSE=1 -fMakefile ${ARGV0}' ; then +# echo " successful compilation of ${ARGV0}" >> ${ERRORFILE} +# SUCCESS="y" +# else +# echo " ERROR: compilation of ${ARGV0}" >> ${ERRORFILE} +# SUCCESS="" +# fi +# +# if [ -n "${DO_RUN}" ] ; then +# if [ -n "${SUCCESS}" ] ; then +# run_test ${ARGV0} +# else +# echo " ERROR: not executed ${ARGV0}" >> ${ERRORFILE} +# fi +# fi +endfunction() + +function(execute_commands_old_structure data_dir traits_type_name) + cgal_debug_message(STATUS "# execute_commands_old_structure(data_dir=${data_dir} traits=${traits_type_name} ${ARGN})") + # at first the tests where designed in such way that all the test input was + # in one file, the points, the xcurves, the curves and the execution block + # this function is used to execute the old tests, one may use it when needed + # but you should remember that separating the input into smaller files creates + # much more modular and comfortable test suite + + # the old structure is default, so this function executes all commands + # except the commands that are given as arguments + + set(new_structure FALSE) + set(old_structure TRUE) + + set(commands_indicator_COMPARE 1) + set(commands_indicator_VERTEX 1) + set(commands_indicator_IS_VERTICAL 1) + set(commands_indicator_COMPARE_Y_AT_X 1) + set(commands_indicator_COMPARE_Y_AT_X_LEFT 1) + set(commands_indicator_COMPARE_Y_AT_X_RIGHT 1) + set(commands_indicator_MAKE_X_MONOTONE 1) + set(commands_indicator_INTERSECT 1) + set(commands_indicator_SPLIT 1) + set(commands_indicator_ARE_MERGEABLE 1) + set(commands_indicator_MERGE 1) + set(commands_indicator_ASSERTIONS 1) + set(commands_indicator_CONSTRUCTOR 1) + foreach(arg ${ARGN}) + set(commands_indicator_${arg} 0) + endforeach() + if(commands_indicator_COMPARE) + run_trapped_test(test_traits + data/compare.pt data/empty.zero + data/empty.zero data/compare ${traits_type_name}) + endif() + if(commands_indicator_VERTEX) + run_trapped_test(test_traits + data/${data_dir}/vertex.pt data/${data_dir}/vertex.xcv + data/empty.zero data/${data_dir}/vertex ${traits_type_name}) + endif() + if(commands_indicator_IS_VERTICAL) + run_trapped_test(test_traits + data/empty.zero data/${data_dir}/is_vertical.xcv data/empty.zero + data/${data_dir}/is_vertical ${traits_type_name}) + endif() + if(commands_indicator_COMPARE_Y_AT_X) + run_trapped_test(test_traits + data/${data_dir}/compare_y_at_x.pt data/${data_dir}/compare_y_at_x.xcv + data/empty.zero data/${data_dir}/compare_y_at_x ${traits_type_name}) + endif() + if(commands_indicator_COMPARE_Y_AT_X_LEFT) + run_trapped_test(test_traits + data/${data_dir}/compare_y_at_x_left.pt data/${data_dir}/compare_y_at_x_left.xcv + data/empty.zero data/${data_dir}/compare_y_at_x_left ${traits_type_name}) + endif() + if(commands_indicator_COMPARE_Y_AT_X_RIGHT) + run_trapped_test(test_traits + data/${data_dir}/compare_y_at_x_right.pt data/${data_dir}/compare_y_at_x_right.xcv + data/empty.zero data/${data_dir}/compare_y_at_x_right ${traits_type_name}) + endif() + if(commands_indicator_MAKE_X_MONOTONE) + run_trapped_test(test_traits + data/empty.zero data/${data_dir}/make_x_monotone.xcv + data/${data_dir}/make_x_monotone.cv data/${data_dir}/make_x_monotone ${traits_type_name}) + endif() + if(commands_indicator_INTERSECT) + run_trapped_test(test_traits + data/${data_dir}/intersect.pt data/${data_dir}/intersect.xcv + data/empty.zero data/${data_dir}/intersect ${traits_type_name}) + endif() + if(commands_indicator_SPLIT) + run_trapped_test(test_traits + data/${data_dir}/split.pt data/${data_dir}/split.xcv + data/empty.zero data/${data_dir}/split ${traits_type_name}) + endif() + if(commands_indicator_ARE_MERGEABLE) + run_trapped_test(test_traits + data/empty.zero data/${data_dir}/are_mergeable.xcv + data/empty.zero data/${data_dir}/are_mergeable ${traits_type_name}) + endif() + if(commands_indicator_MERGE) + run_trapped_test(test_traits + data/empty.zero data/${data_dir}/merge.xcv + data/empty.zero data/${data_dir}/merge ${traits_type_name}) + endif() + if(commands_indicator_ASSERTIONS) + run_trapped_test(test_traits + data/${data_dir}/assertions.pt data/${data_dir}/assertions.xcv + data/empty.zero data/${data_dir}/assertions ${traits_type_name}) + endif() + if(commands_indicator_CONSTRUCTOR) + run_trapped_test(test_traits + data/empty.zero data/${data_dir}/constructor.xcv + data/${data_dir}/constructor.cv data/${data_dir}/constructor ${traits_type_name}) + endif() +endfunction() + +function(execute_commands_new_structure data_dir traits_type_name) + cgal_debug_message(STATUS "# execute_commands_new_structure(data_dir=${data_dir} traits=${traits_type_name} ${ARGN} )") +# the new design for the tests includes separation of the test input into 4 +# parts: points file, xcurves file, curves file and execution block file. +# one may reuse the input files for the various tests + +# the new structure is not default, so this function executes only +# commands that are given as arguments + + set(new_structure TRUE) + set(old_structure FALSE) + + set(commands_indicator_COMPARE 0) + set(commands_indicator_VERTEX 0) + set(commands_indicator_IS_VERTICAL 0) + set(commands_indicator_COMPARE_X_AT_LIMIT 0) + set(commands_indicator_COMPARE_X_NEAR_LIMIT 0) + set(commands_indicator_COMPARE_X_ON_BOUNDARY 0) + set(commands_indicator_COMPARE_X_NEAR_BOUNDARY 0) + set(commands_indicator_COMPARE_Y_NEAR_BOUNDARY 0) + set(commands_indicator_PARAMETER_SPACE_X 0) + set(commands_indicator_PARAMETER_SPACE_Y 0) + set(commands_indicator_COMPARE_Y_AT_X 0) + set(commands_indicator_COMPARE_Y_AT_X_LEFT 0) + set(commands_indicator_COMPARE_Y_AT_X_RIGHT 0) + set(commands_indicator_MAKE_X_MONOTONE 0) + set(commands_indicator_INTERSECT 0) + set(commands_indicator_SPLIT 0) + set(commands_indicator_ARE_MERGEABLE 0) + set(commands_indicator_MERGE 0) + set(commands_indicator_ASSERTIONS 0) + set(commands_indicator_CONSTRUCTOR 0) + set(commands_indicator_EQUAL 0) + set(commands_indicator_PUSH_BACK 0) + set(commands_indicator_PUSH_FRONT 0) + set(commands_indicator_NUMBER_OF_POINTS 0) + set(commands_indicator_COMPARE_ENDPOINTS_XY 0) + set(commands_indicator_CONSTRUCT_OPPOSITE 0) + set(commands_indicator_TRIM 0) + foreach(arg ${ARGN}) + set(commands_indicator_${arg} 1) + endforeach() + if(commands_indicator_COMPARE) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/compare ${traits_type_name}) + endif() + if(commands_indicator_VERTEX) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/vertex ${traits_type_name}) + endif() + if(commands_indicator_IS_VERTICAL) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/is_vertical ${traits_type_name}) + endif() + if(commands_indicator_COMPARE_X_AT_LIMIT) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/compare_x_at_limit ${traits_type_name}) + endif() + if(commands_indicator_COMPARE_X_NEAR_LIMIT) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/compare_x_near_limit ${traits_type_name}) + endif() + if(commands_indicator_COMPARE_X_ON_BOUNDARY) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/compare_x_on_boundary ${traits_type_name}) + endif() + if(commands_indicator_COMPARE_X_NEAR_BOUNDARY) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/compare_x_near_boundary ${traits_type_name}) + endif() + if(commands_indicator_COMPARE_Y_NEAR_BOUNDARY) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/compare_y_near_boundary ${traits_type_name}) + endif() + if(commands_indicator_PARAMETER_SPACE_X) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/parameter_space_x ${traits_type_name}) + endif() + if(commands_indicator_PARAMETER_SPACE_Y) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/parameter_space_y ${traits_type_name}) + endif() + if(commands_indicator_COMPARE_Y_AT_X) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/compare_y_at_x ${traits_type_name}) + endif() + if(commands_indicator_COMPARE_Y_AT_X_LEFT) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/compare_y_at_x_left ${traits_type_name}) + endif() + if(commands_indicator_COMPARE_Y_AT_X_RIGHT) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/compare_y_at_x_right ${traits_type_name}) + endif() + if(commands_indicator_MAKE_X_MONOTONE) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/make_x_monotone ${traits_type_name}) + endif() + if(commands_indicator_INTERSECT) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/intersect ${traits_type_name}) + endif() + if(commands_indicator_SPLIT) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/split ${traits_type_name}) + endif() + if(commands_indicator_ARE_MERGEABLE) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/are_mergeable ${traits_type_name}) + endif() + if(commands_indicator_MERGE) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/merge ${traits_type_name}) + endif() + if(commands_indicator_ASSERTIONS) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/assertions ${traits_type_name}) + endif() + if(commands_indicator_CONSTRUCTOR) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/constructor ${traits_type_name}) + endif() + if(commands_indicator_EQUAL) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/equal ${traits_type_name}) + endif() + if(commands_indicator_PUSH_BACK) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/push_back ${traits_type_name}) + endif() + if(commands_indicator_PUSH_FRONT) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/push_front ${traits_type_name}) + endif() + if(commands_indicator_NUMBER_OF_POINTS) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/number_of_points ${traits_type_name}) + endif() + if(commands_indicator_COMPARE_ENDPOINTS_XY) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/compare_endpoints_xy ${traits_type_name}) + endif() + if(commands_indicator_CONSTRUCT_OPPOSITE) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/construct_opposite ${traits_type_name}) + endif() + if(commands_indicator_TRIM) + run_trapped_test(test_traits data/${data_dir}/points + data/${data_dir}/xcurves data/${data_dir}/curves data/${data_dir}/trim ${traits_type_name}) + endif() +endfunction() + +function(execute_commands_traits_adaptor data_dir traits_type_name) + cgal_debug_message(STATUS "# execute_commands_traits_adaptor(data_dir=${data_dir} traits=${traits_type_name} ${ARGN} )") +# the new structure is not default, so this function executes only +# commands that are given as arguments + + set(commands_indicator_PARAMETER_SPACE_X 0) + set(commands_indicator_PARAMETER_SPACE_Y 0) + set(commands_indicator_COMPARE_X_AT_LIMIT 0) + set(commands_indicator_COMPARE_X_NEAR_LIMIT 0) + set(commands_indicator_COMPARE_X_ON_BOUNDARY 0) + set(commands_indicator_COMPARE_X_NEAR_BOUNDARY 0) + set(commands_indicator_COMPARE_Y_NEAR_BOUNDARY 0) + set(commands_indicator_COMPARE_Y_AT_X_LEFT 0) + set(commands_indicator_ARE_MERGEABLE 0) + set(commands_indicator_MERGE 0) + set(commands_indicator_X_ON_IDENTIFICATION 0) + set(commands_indicator_Y_ON_IDENTIFICATION 0) + set(commands_indicator_IS_BOUNDED 0) + set(commands_indicator_IS_IN_X_RANGE 0) + set(commands_indicator_COMPARE_Y_POSITION 0) + set(commands_indicator_IS_BETWEEN_CW 0) + set(commands_indicator_COMPARE_CW_AROUND_POINT 0) + foreach(arg ${ARGN}) + set(commands_indicator_${arg} 1) + endforeach() + + if(commands_indicator_PARAMETER_SPACE_X) + run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points + data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves + data/test_adaptor/${data_dir}/parameter_space_x ${traits_type_name}) + endif() + if(commands_indicator_PARAMETER_SPACE_Y) + run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points + data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves + data/test_adaptor/${data_dir}/parameter_space_y ${traits_type_name}) + endif() + if(commands_indicator_COMPARE_X_AT_LIMIT) + run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points + data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves + data/test_adaptor/${data_dir}/compare_x_at_limit ${traits_type_name}) + endif() + if(commands_indicator_COMPARE_X_NEAR_LIMIT) + run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points + data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves + data/test_adaptor/${data_dir}/compare_x_near_limit ${traits_type_name}) + endif() + + if(commands_indicator_COMPARE_X_ON_BOUNDARY) + run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points + data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves + data/test_adaptor/${data_dir}/compare_x_on_boundary ${traits_type_name}) + endif() + if(commands_indicator_COMPARE_X_NEAR_BOUNDARY) + run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points + data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves + data/test_adaptor/${data_dir}/compare_x_near_boundary ${traits_type_name}) + endif() + + if(commands_indicator_COMPARE_Y_NEAR_BOUNDARY) + run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points + data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves + data/test_adaptor/${data_dir}/compare_y_near_boundary ${traits_type_name}) + endif() + if(commands_indicator_COMPARE_Y_AT_X_LEFT) + run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points + data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves + data/test_adaptor/${data_dir}/compare_y_at_x_left ${traits_type_name}) + endif() + if(commands_indicator_ARE_MERGEABLE) + run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points + data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves + data/test_adaptor/${data_dir}/are_mergeable ${traits_type_name}) + endif() + if(commands_indicator_MERGE) + run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points + data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves + data/test_adaptor/${data_dir}/merge ${traits_type_name}) + endif() + if(commands_indicator_X_ON_IDENTIFICATION) + run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points + data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves + data/test_adaptor/${data_dir}/x_on_idintification ${traits_type_name}) + endif() + if(commands_indicator_Y_ON_IDENTIFICATION) + run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points + data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves + data/test_adaptor/${data_dir}/x_on_idintification ${traits_type_name}) + endif() + if(commands_indicator_IS_BOUNDED) + run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points + data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves + data/test_adaptor/${data_dir}/is_bounded ${traits_type_name}) + endif() + if(commands_indicator_IS_IN_X_RANGE) + run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points + data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves + data/test_adaptor/${data_dir}/is_in_x_range ${traits_type_name}) + endif() + if(commands_indicator_COMPARE_Y_POSITION) + run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points + data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves + data/test_adaptor/${data_dir}/compare_y_position ${traits_type_name}) + endif() + if(commands_indicator_IS_BETWEEN_CW) + run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points + data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves + data/test_adaptor/${data_dir}/is_between_cw ${traits_type_name}) + endif() + if(commands_indicator_COMPARE_CW_AROUND_POINT) + run_trapped_test(test_traits_adaptor data/test_adaptor/${data_dir}/points + data/test_adaptor/${data_dir}/xcurves data/test_adaptor/${data_dir}/curves + data/test_adaptor/${data_dir}/compare_cw_around_point ${traits_type_name}) + endif() +endfunction() + +#---------------------------------------------------------------------# +# traits adaptor (segments traits) +#---------------------------------------------------------------------# +function(test_segment_traits_adaptor) + set(nt ${QUOTIENT_MP_FLOAT_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${SEGMENT_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + + compile_test_with_flags(test_traits_adaptor segments "${flags}") +# if [ -n "${SUCCESS}" ] ; then + execute_commands_traits_adaptor( segments segments_traits_adaptor + COMPARE_Y_POSITION COMPARE_CW_AROUND_POINT COMPARE_Y_AT_X_LEFT + ARE_MERGEABLE MERGE IS_IN_X_RANGE IS_BETWEEN_CW) +# else +# echo " ERROR: not executed test_traits_adaptor segment_traits" >> ${ERRORFILE} +# fi +# clean_tests +endfunction() + +#---------------------------------------------------------------------# +# traits adaptor (linear traits) +#---------------------------------------------------------------------# +function(test_linear_traits_adaptor) + set(nt ${QUOTIENT_MP_FLOAT_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${LINEAR_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + + compile_test_with_flags( test_traits_adaptor linear "${flags}") +# if [ -n "${SUCCESS}" ] ; then + execute_commands_traits_adaptor( linear linear_traits_adaptor + COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE + COMPARE_Y_POSITION IS_BETWEEN_CW COMPARE_CW_AROUND_POINT) +# else +# echo " ERROR: not executed test_traits_adaptor linear_traits" >> ${ERRORFILE} +# fi +# clean_tests +endfunction() + +#---------------------------------------------------------------------# +# traits adaptor (spherical arcs traits) +#---------------------------------------------------------------------# +function(test_spherical_arcs_traits_adaptor) + set(nt ${CGAL_GMPQ_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${GEODESIC_ARC_ON_SPHERE_GEOM_TRAITS}) + set(topol_traits ${SPHERICAL_TOPOL_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits} -DTEST_TOPOL_TRAITS=${topol_traits}") + + compile_test_with_flags( test_traits_adaptor geodesic_arcs_on_sphere "${flags}") +# if [ -n "${SUCCESS}" ] ; then + execute_commands_traits_adaptor( spherical_arcs spherical_arcs_traits_adaptor + COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE + COMPARE_Y_POSITION IS_BETWEEN_CW COMPARE_CW_AROUND_POINT) +# else +# echo " ERROR: not executed test_traits_adaptor spherical_arcs_traits" >> ${ERRORFILE} +# fi +# clean_tests +endfunction() + +#---------------------------------------------------------------------# +# compile and run test with traits +#---------------------------------------------------------------------# +function(compile_and_run_with_flags) + set(name ${ARGV0}) + set(type ${ARGV1}) + set(flags ${ARGV2}) + + compile_test_with_flags( ${name} ${type} "${flags}") +# if [ -n "${SUCCESS}" ] ; then +# if [ -n "${DO_RUN}" ] ; then + run_test_with_flags( ${name} ${type}) +# fi +# else +# echo " ERROR: not executed construction of segments" >> ${ERRORFILE} +# fi +# clean_tests +endfunction() + +#---------------------------------------------------------------------# +# construction with segments +#---------------------------------------------------------------------# +function(test_construction_segments) + set(nt ${CGAL_GMPQ_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${SEGMENT_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + compile_and_run_with_flags( test_construction segments "${flags}") +endfunction() + +#---------------------------------------------------------------------# +# construction with linear curves +#---------------------------------------------------------------------# +function(test_construction_linear_curves) + set(nt ${CGAL_GMPQ_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${LINEAR_GEOM_TRAITS}) + set(topol_traits ${PLANAR_UNBOUNDED_TOPOL_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits} -DTEST_TOPOL_TRAITS=${topol_traits}") + compile_and_run_with_flags( test_construction linear "${flags}") +endfunction() + +#---------------------------------------------------------------------# +# construction with geodesic arcs on the sphere +#---------------------------------------------------------------------# +function(test_construction_spherical_arcs) + set(nt ${CGAL_GMPQ_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${GEODESIC_ARC_ON_SPHERE_GEOM_TRAITS}) + set(topol_traits ${SPHERICAL_TOPOL_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits} -DTEST_TOPOL_TRAITS=${topol_traits}") + compile_and_run_with_flags( test_construction geodesic_arcs_on_sphere "${flags}") +endfunction() + +#---------------------------------------------------------------------# +# overlay with segments +#---------------------------------------------------------------------# +function(test_overlay_segments) + set(nt ${CGAL_GMPQ_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${SEGMENT_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + compile_and_run_with_flags(test_overlay segments "${flags}") +endfunction() + +#---------------------------------------------------------------------# +# overlay with geodesic arcs on the sphere +#---------------------------------------------------------------------# +function(test_overlay_spherical_arcs) + set(nt ${CGAL_GMPQ_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${GEODESIC_ARC_ON_SPHERE_GEOM_TRAITS}) + set(topol_traits ${SPHERICAL_TOPOL_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits} -DTEST_TOPOL_TRAITS=${topol_traits}") + compile_and_run_with_flags(test_overlay geodesic_arcs_on_sphere "${flags}") +endfunction() + +#---------------------------------------------------------------------# +# point location with segments +#---------------------------------------------------------------------# +function(test_point_location_segments) + set(nt ${CGAL_GMPQ_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${SEGMENT_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + compile_and_run_with_flags(test_point_location segments "${flags}") +endfunction() + +# For backward compatibility +function(test_point_location_segments_version) + set(nt ${CGAL_GMPQ_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${SEGMENT_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits} -DCGAL_ARR_POINT_LOCATION_VERSION=1") + compile_and_run_with_flags(test_point_location segments "${flags}") +endfunction() + +# For backward compatibility +function(test_point_location_segments_conversion) + set(nt ${CGAL_GMPQ_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${SEGMENT_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits} -DCGAL_ARR_POINT_LOCATION_CONVERSION") + compile_and_run_with_flags(test_point_location segments "${flags}") +endfunction() + +#---------------------------------------------------------------------# +# point location dynamic with segments +#---------------------------------------------------------------------# +function(test_point_location_dynamic_segments) + set(nt ${CGAL_GMPQ_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${SEGMENT_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + compile_and_run_with_flags(test_point_location_dynamic segments "${flags}") +endfunction() + +#---------------------------------------------------------------------# +# point location with circle segments +#---------------------------------------------------------------------# +function(test_point_location_circle_segments) + set(nt ${CGAL_GMPQ_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${CIRCLE_SEGMENT_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + compile_and_run_with_flags(test_point_location circle_segments "${flags}") +endfunction() + +#---------------------------------------------------------------------# +# point location with linear objects +#---------------------------------------------------------------------# +function(test_point_location_linear) + set(nt ${CGAL_GMPQ_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${LINEAR_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + compile_and_run_with_flags(test_point_location linear "${flags}") +endfunction() + +#---------------------------------------------------------------------# +# batchecd point location with segments +#---------------------------------------------------------------------# +function(test_batched_point_location_segments) + set(nt ${CGAL_GMPQ_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${SEGMENT_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + compile_and_run_with_flags(test_batched_point_location segments "${flags}") +endfunction() + +#---------------------------------------------------------------------# +# batchecd point location with linear objects +#---------------------------------------------------------------------# +function(test_batched_point_location_linear) + set(nt ${CGAL_GMPQ_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${LINEAR_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + compile_and_run_with_flags(test_batched_point_location linear "${flags}") +endfunction() + +#---------------------------------------------------------------------# +# batchecd point location with geodesic arcs on the sphere +#---------------------------------------------------------------------# +function(test_batched_point_location_spherical_arcs) + set(nt ${CGAL_GMPQ_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${GEODESIC_ARC_ON_SPHERE_GEOM_TRAITS}) + set(topol_traits ${SPHERICAL_TOPOL_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits} -DTEST_TOPOL_TRAITS=${topol_traits}") + compile_and_run_with_flags(test_batched_point_location geodesic_arcs_on_sphere "${flags}") +endfunction() + +#---------------------------------------------------------------------# +# vertical decomposition with segments +#---------------------------------------------------------------------# +function(test_vertical_decomposition_segments) + set(nt ${CGAL_GMPQ_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${SEGMENT_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + compile_and_run_with_flags(test_vertical_decomposition segments "${flags}") +endfunction() + +#---------------------------------------------------------------------# +# vertical decomposition with linear objects +#---------------------------------------------------------------------# +function(test_vertical_decomposition_linear) + set(nt ${CGAL_GMPQ_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${LINEAR_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + compile_and_run_with_flags(test_vertical_decomposition linear "${flags}") +endfunction() + +#---------------------------------------------------------------------# +# vertical decomposition with geodesic arcs on the sphere +#---------------------------------------------------------------------# +function(test_vertical_decomposition_spherical_arcs) + set(nt ${CGAL_GMPQ_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${LINEAR_GEOM_TRAITS}) + set(topol_traits ${SPHERICAL_TOPOL_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits} -DTEST_TOPOL_TRAITS=${topol_traits}") + compile_and_run_with_flags(test_vertical_decomposition geodesic_arcs_on_sphere "${flags}") +endfunction() + +#---------------------------------------------------------------------# +# segment traits +#---------------------------------------------------------------------# +function(test_segment_traits) + set(nt ${QUOTIENT_MP_FLOAT_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${SEGMENT_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + + compile_test_with_flags(test_traits segments "${flags}") +# if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure( segments segment_traits + VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT CONSTRUCTOR + COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE) + + execute_commands_new_structure( segments segment_traits + IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT ARE_MERGEABLE) + + run_trapped_test( test_traits + data/segments/vertex.pt data/segments/xcurves + data/empty.zero data/segments/vertex segment_traits) +# else +# echo " ERROR: not executed test_traits segment_traits" >> ${ERRORFILE} +# fi +# clean_tests +endfunction() + +#---------------------------------------------------------------------# +# non-caching segment traits +#---------------------------------------------------------------------# +function(test_non_caching_segment_traits) + set(nt ${CGAL_GMPQ_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${NON_CACHING_SEGMENT_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + + compile_test_with_flags(test_traits non_caching_segments "${flags}") + # if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure(segments non_caching_segment_traits + VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT CONSTRUCTOR + COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE ASSERTIONS) + + execute_commands_new_structure(segments segment_traits + IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT) + + run_trapped_test(test_traits + data/segments/vertex.pt data/segments/xcurves + data/empty.zero data/segments/vertex non_caching_segment_traits) + # else + # echo " ERROR: not executed test_traits non_caching_segment_traits" >> ${ERRORFILE} + # fi + # clean_tests +endfunction() + +#---------------------------------------------------------------------# +# polycurve conic traits +#---------------------------------------------------------------------# +function(test_polycurve_conic_traits) +# echo polycurve test starting + set(nt ${CORE_EXPR_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${POLYCURVE_CONIC_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + + compile_test_with_flags(test_traits conic_polycurve "${flags}") +# if [ -n "${SUCCESS}" ] ; then + + # The input arguments for the execute_commands_new_structure, + # 1. Polycurve_conics is the directory name in "data" + # 2. polycurve_conic_traits is a string + # Execute_command_new_structure will only run the test on functors provided as the third, fourth and so on arguments. + # To see how the input data directory should be structured for each functor, check the execute_commands_new_structure function in this file. + execute_commands_new_structure(polycurves_conics polycurve_conic_traits + COMPARE_Y_AT_X + INTERSECT + EQUAL + IS_VERTICAL + SPLIT + ARE_MERGEABLE + COMPARE_Y_AT_X_LEFT + COMPARE_Y_AT_X_RIGHT + MAKE_X_MONOTONE + PUSH_BACK + PUSH_FRONT + NUMBER_OF_POINTS + VERTEX + CONSTRUCT_OPPOSITE + MERGE + COMPARE_ENDPOINTS_XY + TRIM) + +# else +# echo " ERROR: not executed test_traits polyline_traits" >> ${ERRORFILE} +# fi +# clean_tests +endfunction() + +#---------------------------------------------------------------------# +# polycurve arc traits +#---------------------------------------------------------------------# +function(test_polycurve_circular_arc_traits) + set(nt ${QUOTIENT_MP_FLOAT_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${POLYCURVE_CIRCULAR_ARC_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + + compile_test_with_flags(test_traits circular_arc_polycurve "${flags}") +# if [ -n "${SUCCESS}" ] ; then + execute_commands_new_structure(Polycurves_circular_arcs polycurve_circular_arc_traits + COMPARE_Y_AT_X + EQUAL + IS_VERTICAL + SPLIT + ARE_MERGEABLE + COMPARE_Y_AT_X_LEFT + COMPARE_Y_AT_X_RIGHT + MAKE_X_MONOTONE + PUSH_BACK + PUSH_FRONT + NUMBER_OF_POINTS + VERTEX + CONSTRUCT_OPPOSITE + MERGE + COMPARE_ENDPOINTS_XY + INTERSECT) + +# else +# echo " ERROR: not executed test_traits polyline_traits" >> ${ERRORFILE} +# fi +# clean_tests +endfunction() + +#---------------------------------------------------------------------# +# polycurve bezier traits +#---------------------------------------------------------------------# +function(test_polycurve_bezier_traits) + set(nt ${CORE_EXPR_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${POLYCURVE_BEZIER_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + + compile_test_with_flags(test_traits bezier_polycurve "${flags}") +# if [ -n "${SUCCESS}" ] ; then + execute_commands_new_structure(Polycurves_bezier test_polycurve_bezier_traits + MERGE + EQUAL + IS_VERTICAL + NUMBER_OF_POINTS + PUSH_BACK + PUSH_FRONT + VERTEX + ARE_MERGEABLE + COMPARE_ENDPOINTS_XY + # TODO (add data for these tests) + # COMPARE_Y_AT_X + # SPLIT + # COMPARE_Y_AT_X_LEFT + # COMPARE_Y_AT_X_RIGHT + # MAKE_X_MONOTONE + # CONSTRUCT_OPPOSITE + + # INTERSECT + ) +# else +# echo " ERROR: not executed test_traits polyline_traits" >> ${ERRORFILE} +# fi +# clean_tests +endfunction() + +#---------------------------------------------------------------------# +# polyline traits +#---------------------------------------------------------------------# +function(test_polyline_traits) + set(nt ${CGAL_GMPQ_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${POLYLINE_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + + compile_test_with_flags(test_traits test_polylines "${flags}") +# if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure(polylines polyline_traits + CONSTRUCTOR COMPARE_Y_AT_X_LEFT + COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE) +# else +# echo " ERROR: not executed test_traits polyline_traits" >> ${ERRORFILE} +# fi +# clean_tests +endfunction() + +#---------------------------------------------------------------------# +# non-caching polyline traits +#---------------------------------------------------------------------# +function(test_non_caching_polyline_traits) + set(nt ${CGAL_GMPQ_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${NON_CACHING_POLYLINE_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + + compile_test_with_flags(test_traits non_caching_polylines "${flags}") +# if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure(polylines non_caching_polyline_traits + CONSTRUCTOR COMPARE_Y_AT_X_LEFT + COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE) +# else +# echo " ERROR: not executed test_traits non_caching_polyline_traits" >> ${ERRORFILE} +# fi +# clean_tests +endfunction() + +#---------------------------------------------------------------------# +# linear traits +#---------------------------------------------------------------------# +function(test_linear_traits) + set(nt ${QUOTIENT_MP_FLOAT_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${LINEAR_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + + compile_test_with_flags(test_traits linear "${flags}") +# if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure(linear/segments linear_traits.segments + VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT + COMPARE_Y_AT_X_RIGHT CONSTRUCTOR ARE_MERGEABLE) + + execute_commands_new_structure(linear/segments linear_traits.segments + IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT) + + run_trapped_test(test_traits + data/linear/segments/vertex.pt data/linear/segments/xcurves + data/empty.zero data/linear/segments/vertex linear_traits.segments) + + execute_commands_old_structure(linear/rays linear_traits.rays + VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT + COMPARE_Y_AT_X_RIGHT CONSTRUCTOR ARE_MERGEABLE) + + execute_commands_new_structure(linear/rays linear_traits.rays + IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT) + + run_trapped_test(test_traits + data/linear/rays/vertex.pt data/linear/rays/xcurves + data/empty.zero data/linear/rays/vertex linear_traits.rays) + + execute_commands_new_structure(linear/lines linear_traits.lines + IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT INTERSECT + SPLIT MERGE + PARAMETER_SPACE_X PARAMETER_SPACE_Y + COMPARE_X_AT_LIMIT COMPARE_X_NEAR_LIMIT COMPARE_Y_NEAR_BOUNDARY) +# else +# echo " ERROR: not executed test_traits linear_traits" >> ${ERRORFILE} +# fi +# clean_tests +endfunction() + +#---------------------------------------------------------------------# +# conic traits +#---------------------------------------------------------------------# +function(test_conic_traits) + set(nt ${CORE_EXPR_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${CORE_CONIC_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + + compile_test_with_flags(test_traits conics "${flags}") +# if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure(conics conic_traits + INTERSECT SPLIT MERGE COMPARE_Y_AT_X_LEFT + COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE) + + execute_commands_new_structure(conics conic_traits + INTERSECT SPLIT MERGE) + + run_trapped_test(test_traits + data/conics/compare.pt data/empty.zero + data/empty.zero data/conics/compare conic_traits) +# else +# echo " ERROR: not executed test_traits conic_traits" >> ${ERRORFILE} +# fi +# clean_tests +endfunction() + +#---------------------------------------------------------------------# +# "line arcs" (segments) only +#---------------------------------------------------------------------# +function(test_line_arc_traits) + set(nt ${QUOTIENT_MP_FLOAT_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${LINE_ARC_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + + compile_test_with_flags(test_traits line_arcs "${flags}") +# if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure(circular_lines line_arc_traits + VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT + ASSERTIONS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE) + + execute_commands_new_structure(circular_lines line_arc_traits + IS_VERTICAL COMPARE_Y_AT_X) + + run_trapped_test(test_traits + data/circular_lines/compare.pt data/empty.zero + data/empty.zero data/circular_lines/compare line_arc_traits) + + run_trapped_test(test_traits + data/circular_lines/vertex.pt data/circular_lines/xcurves + data/empty.zero data/circular_lines/vertex line_arc_traits) +# else +# echo " ERROR: not executed test_traits" >> ${ERRORFILE} +# fi +# clean_tests +endfunction() + +#---------------------------------------------------------------------# +# circular arcs only +#---------------------------------------------------------------------# +function(test_circular_arc_traits) + set(nt ${QUOTIENT_MP_FLOAT_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${CIRCULAR_ARC_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + + compile_test_with_flags(test_traits circular_arcs "${flags}") + # if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure(circular_arcs circular_arc_traits + VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT + ASSERTIONS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE) + + execute_commands_new_structure(circular_arcs circular_arc_traits + VERTEX IS_VERTICAL COMPARE_Y_AT_X) + # else + # echo " ERROR: not executed test_traits" >> ${ERRORFILE} + # fi + # clean_tests +endfunction() + +#---------------------------------------------------------------------# +# circular and line arcs +#---------------------------------------------------------------------# +function(test_circular_line_arc_traits) + set(nt ${QUOTIENT_MP_FLOAT_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${CIRCULAR_LINE_ARC_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + + compile_test_with_flags(test_traits circular_line_arcs "${flags}") + # if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure(circular_line_arcs circular_line_arc_traits + VERTEX IS_VERTICAL CONSTRUCTOR COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT + ASSERTIONS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE) + + execute_commands_new_structure(circular_line_arcs circular_line_arc_traits + IS_VERTICAL COMPARE_Y_AT_X) + + run_trapped_test(test_traits + data/circular_line_arcs/vertex.pt data/circular_line_arcs/xcurves + data/empty.zero data/circular_line_arcs/vertex circular_line_arc_traits) + # else + # echo " ERROR: not executed test_traits circular_line_arc_traits" >> ${ERRORFILE} + # fi + # clean_tests +endfunction() + +#---------------------------------------------------------------------# +# circle segment traits +#---------------------------------------------------------------------# +function(test_circle_segments_traits) + set(nt ${QUOTIENT_MP_FLOAT_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${CIRCLE_SEGMENT_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + + compile_test_with_flags(test_traits circle_segments "${flags}") + # if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure(circle_segments circle_segments_traits + VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT + COMPARE_Y_AT_X_RIGHT CONSTRUCTOR ARE_MERGEABLE) + + run_trapped_test(test_traits + data/circle_segments/points data/circle_segments/xcurves.8 + data/empty.zero data/circle_segments/vertex circle_segments_traits) + run_trapped_test(test_traits + data/empty.zero data/circle_segments/xcurves.8 + data/empty.zero data/circle_segments/is_vertical circle_segments_traits) + run_trapped_test(test_traits + data/circle_segments/points data/circle_segments/xcurves.8 + data/empty.zero data/circle_segments/compare_y_at_x circle_segments_traits) + run_trapped_test(test_traits + data/circle_segments/points data/circle_segments/xcurves.16 + data/empty.zero data/circle_segments/compare_y_at_x_left circle_segments_traits) + run_trapped_test(test_traits + data/circle_segments/points data/circle_segments/xcurves.16 + data/empty.zero data/circle_segments/compare_y_at_x_right circle_segments_traits) + run_trapped_test(test_traits + data/empty.zero data/circle_segments/constructor.xcv + data/empty.zero data/circle_segments/constructor circle_segments_traits) + # else + # echo " ERROR: not executed test_traits circle_segments_traits" >> ${ERRORFILE} + # fi + # clean_tests +endfunction() + +#---------------------------------------------------------------------# +# bezier traits +#---------------------------------------------------------------------# +function(test_bezier_traits) + set(nt ${CORE_EXPR_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${BEZIER_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + + compile_test_with_flags(test_traits Bezier "${flags}") + # if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure(bezier bezier_traits + COMPARE_Y_AT_X_LEFT COMPARE_Y_AT_X_RIGHT SPLIT + CONSTRUCTOR ASSERTIONS ARE_MERGEABLE) + # else + # echo " ERROR: not executed test_traits bezier_traits" >> ${ERRORFILE} + # fi + # clean_tests +endfunction() + +#---------------------------------------------------------------------# +# spherical arc traits +#---------------------------------------------------------------------# +function(test_spherical_arc_traits) + set(nt ${CGAL_GMPQ_NT}) + set(kernel ${CARTESIAN_KERNEL}) + set(geom_traits ${GEODESIC_ARC_ON_SPHERE_GEOM_TRAITS}) + set(topol_traits ${SPHERICAL_TOPOL_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits} -DTEST_TOPOL_TRAITS=${topol_traits}") + + compile_test_with_flags(test_traits geodesic_arcs_on_sphere "${flags}") + # if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure(spherical_arcs spherical_arc_traits + COMPARE_Y_AT_X_LEFT COMPARE_Y_AT_X_RIGHT INTERSECT + CONSTRUCTOR + COMPARE MAKE_X_MONOTONE SPLIT MERGE ASSERTIONS ARE_MERGEABLE) + + execute_commands_new_structure(spherical_arcs spherical_arc_traits + INTERSECT + COMPARE_X_ON_BOUNDARY COMPARE_X_NEAR_BOUNDARY + COMPARE_Y_NEAR_BOUNDARY) + + run_trapped_test(test_traits + data/spherical_arcs/compare.pt data/spherical_arcs/compare.xcv + data/empty.zero data/spherical_arcs/compare spherical_arc_traits) + # else + # echo " ERROR: not executed test_traits spherical_arc_traits" >> ${ERRORFILE} + # fi + # clean_tests +endfunction() + +#---------------------------------------------------------------------# +# rational arc traits +#---------------------------------------------------------------------# +function(test_rational_arc_traits) + set(nt ${CORE_INT_NT}) + set(kernel ${UNIVARIATE_ALGEBRAIC_KERNEL}) + set(geom_traits ${RATIONAL_ARC_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + + compile_test_with_flags(test_traits rational_arcs "${flags}") + # if [ -n "${SUCCESS}" ] ; then + run_trapped_test(test_traits + data/compare.pt data/empty.zero + data/empty.zero data/compare rational_arc_traits) + + execute_commands_new_structure(rational_arcs rational_arc_traits + VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT SPLIT MERGE + COMPARE_X_AT_LIMIT COMPARE_X_NEAR_LIMIT COMPARE_Y_NEAR_BOUNDARY) + # else + # echo " ERROR: not executed test_traits rational_arc_traits" >> ${ERRORFILE} + # fi + # clean_tests +endfunction() + +#---------------------------------------------------------------------# +# algebraic traits with GMP/MPFI +#---------------------------------------------------------------------# +function(test_algebraic_traits_gmp) + #TODO: Adapt + + set(nt ${CGAL_GMPZ_NT}) + set(kernel ${UNIVARIATE_ALGEBRAIC_KERNEL}) + set(geom_traits ${ALGEBRAIC_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + + compile_test_with_flags(test_traits algebraic "${flags}") + # if [ -n "${SUCCESS}" ] ; then + execute_commands_new_structure(algebraic algebraic_traits_gmp + COMPARE COMPARE_Y_AT_X COMPARE_Y_AT_X_RIGHT COMPARE_Y_AT_X_LEFT + MAKE_X_MONOTONE IS_VERTICAL VERTEX SPLIT MERGE INTERSECT + PARAMETER_SPACE_X PARAMETER_SPACE_Y) + # else + # echo " ERROR: not executed test_traits algebraic_traits_gmp" >> ${ERRORFILE} + # fi + # clean_tests +endfunction() + +#---------------------------------------------------------------------# +# algebraic traits with LEDA +#---------------------------------------------------------------------# +function(test_algebraic_traits_leda) + #TODO: Adapt + + set(nt ${LEDA_INT_NT}) + set(kernel ${UNIVARIATE_ALGEBRAIC_KERNEL}) + set(geom_traits ${ALGEBRAIC_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + + compile_test_with_flags(test_traits algebraic "${flags}") + # if [ -n "${SUCCESS}" ] ; then + execute_commands_new_structure(algebraic algebraic_traits_leda + COMPARE COMPARE_Y_AT_X COMPARE_Y_AT_X_RIGHT COMPARE_Y_AT_X_LEFT + MAKE_X_MONOTONE IS_VERTICAL VERTEX SPLIT MERGE INTERSECT + PARAMETER_SPACE_X PARAMETER_SPACE_Y) + # else + # echo " ERROR: not executed test_traits algebraic_traits_leda" >> ${ERRORFILE} + # fi + # clean_tests +endfunction() + + +#---------------------------------------------------------------------# +# algebraic traits with CORE +#---------------------------------------------------------------------# +function(test_algebraic_traits_core) + #TODO: Adapt + + set(nt ${CORE_INT_NT}) + set(kernel ${UNIVARIATE_ALGEBRAIC_KERNEL}) + set(geom_traits ${ALGEBRAIC_GEOM_TRAITS}) + set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") + + compile_test_with_flags(test_traits algebraic "${flags}") + # if [ -n "${SUCCESS}" ] ; then + execute_commands_new_structure(algebraic algebraic_traits_core + COMPARE COMPARE_Y_AT_X COMPARE_Y_AT_X_RIGHT COMPARE_Y_AT_X_LEFT + MAKE_X_MONOTONE IS_VERTICAL VERTEX SPLIT MERGE INTERSECT + PARAMETER_SPACE_X PARAMETER_SPACE_Y) + # else + # echo " ERROR: not executed test_traits algebraic_traits_core" >> ${ERRORFILE} + # fi + # clean_tests +endfunction() + + +configure() +compile_and_run(construction_test_suite_generator) + +test_segment_traits() +test_non_caching_segment_traits() +test_polyline_traits() +test_polycurve_conic_traits() +test_polycurve_circular_arc_traits() +test_polycurve_bezier_traits() +test_non_caching_polyline_traits() +test_linear_traits() +test_conic_traits() + +test_line_arc_traits() # "line arcs" (segments) only +test_circular_arc_traits() # circular arcs only +test_circular_line_arc_traits() # for both + +test_circle_segments_traits() +test_bezier_traits() + +test_spherical_arc_traits() + +test_rational_arc_traits() + +test_algebraic_traits_core() +test_algebraic_traits_gmp() +test_algebraic_traits_leda() + +compile_and_run(test_insertion) +compile_and_run(test_unbounded_rational_insertion) +compile_and_run(test_unbounded_rational_direct_insertion) +compile_and_run(test_rational_function_traits_2) +compile_and_run(test_iso_verts) + +compile_and_run(test_vert_ray_shoot_vert_segments) + +test_construction_segments() +test_construction_linear_curves() +test_construction_spherical_arcs() + +test_overlay_segments() +test_overlay_spherical_arcs() + +test_point_location_segments() +test_point_location_segments_version() +test_point_location_segments_conversion() +test_point_location_circle_segments() +test_point_location_linear() + +test_point_location_dynamic_segments() + +test_batched_point_location_segments() +test_batched_point_location_linear() +test_batched_point_location_spherical_arcs() + +test_vertical_decomposition_segments() +test_vertical_decomposition_linear() +# test_vertical_decomposition_spherical_arcs + +compile_and_run(test_dual) +compile_and_run(test_do_intersect) +compile_and_run(test_zone) + +compile_and_run(test_observer) +compile_and_run(test_do_equal) + +test_segment_traits_adaptor() +test_linear_traits_adaptor() +test_spherical_arcs_traits_adaptor() + +compile_and_run(test_removal) +compile_and_run(test_unbounded_removal) +compile_and_run(test_spherical_removal) + +compile_and_run(test_io) diff --git a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake index dd95a97269f..d9d222e124b 100644 --- a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake +++ b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake @@ -60,40 +60,9 @@ function(create_single_source_cgal_program firstfile ) add_executable(${exe_name} ${all}) - if(BUILD_TESTING) - set(cin_file "${CGAL_CURRENT_SOURCE_DIR}/${exe_name}.cin") - if(EXISTS ${cin_file}) - add_test(NAME ${exe_name} - COMMAND ${CMAKE_COMMAND} - -DCMD:STRING=$ - -DCIN:STRING=${cin_file} - -P "${CGAL_MODULES_DIR}/run_test_with_cin.cmake") -# message(STATUS "add test: ${exe_name} < ${cin_file}") - else() - # TODO: deal with shell globbing; if the `cmd` file contains - # a `*`, then interprete the command using bash. - set(cmd_file "${CGAL_CURRENT_SOURCE_DIR}/${exe_name}.cmd") - if(EXISTS ${cmd_file}) - file(STRINGS "${cmd_file}" CMD_LINES) - set(ARGS) -# message(STATUS "DEBUG test ${exe_name}") - foreach(CMD_LINE ${CMD_LINES}) -# message(STATUS " command line: ${CMD_LINE}") - separate_arguments(CMD_LINE_ARGS UNIX_COMMAND ${CMD_LINE}) -# message(STATUS " args: ${CMD_LINE_ARGS}") - list(APPEND ARGS ${CMD_LINE_ARGS}) - endforeach() - expand_list_with_globbing(ARGS) - endif() -# message(STATUS "add test: ${exe_name} ${ARGS}") - add_test(NAME ${exe_name} COMMAND ${exe_name} ${ARGS}) - endif() - set_property(TEST "${exe_name}" - APPEND PROPERTY LABELS "${PROJECT_NAME}") -# message(STATUS " workding dir: ${CGAL_CURRENT_SOURCE_DIR}") - set_property(TEST "${exe_name}" - PROPERTY WORKING_DIRECTORY ${CGAL_CURRENT_SOURCE_DIR}) - endif(BUILD_TESTING) + if(NOT NO_TESTING) + cgal_add_test("${exe_name}") + endif(NOT NO_TESTING) add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${exe_name} ) diff --git a/Installation/cmake/modules/CGAL_add_test.cmake b/Installation/cmake/modules/CGAL_add_test.cmake new file mode 100644 index 00000000000..56fc661e989 --- /dev/null +++ b/Installation/cmake/modules/CGAL_add_test.cmake @@ -0,0 +1,110 @@ +if(CGAL_add_test_included) + return() +endif(CGAL_add_test_included) +set(CGAL_add_test_included TRUE) + + +# Process a list, and replace items contains a file pattern (like +# `*.off`) by the sublist that corresponds to the globbing of the +# pattern in the directory `${CGAL_CURRENT_SOURCE_DIR}`. +# +# +# For example: the `file +# test/Poisson_surface_reconstruction_3/poisson_reconstruction_test.cmd` +# contains: +# +# data/*.off data/*.xyz data/*.pwn +# +# For that file, the list `ARGS` computed in the function +# `create_single_source_cgal_program` (see below) is the list: +# +# data/*.off;data/*.xyz;data/*.pwn +# +# A call to `expand_list_with_globbing(ARGS)` replaces the list by: +# +# data/ChineseDragon-10kv.off;data/robocat_deci.off;data/sphere_20k.xyz;data/oni.pwn" +# +function(expand_list_with_globbing list_name) + set(input_list ${${list_name}}) +# message(STATUS "expand_list_with_globbing(${list_name}), ${list_name} is: ${input_list}") + list(LENGTH input_list list_lenght) + math(EXPR list_last_n "${list_lenght} - 1") + set(output_list) + foreach(n RANGE ${list_last_n}) +# message(STATUS "n=${n}") + list(GET input_list ${n} item_n) +# message(STATUS "argument ${n} is ${item_n}") + if(item_n MATCHES ".*\\*.*") + file(GLOB files RELATIVE ${CGAL_CURRENT_SOURCE_DIR} ${item_n}) + list(APPEND output_list ${files}) + else() + list(APPEND output_list ${item_n}) + endif() +# message(STATUS " new value of the output list: ${output_list}") + endforeach() + set(${list_name} ${output_list} PARENT_SCOPE) +endfunction() + +function(cgal_add_test exe_name) + set(cin_file "${CGAL_CURRENT_SOURCE_DIR}/${exe_name}.cin") + if(EXISTS ${cin_file}) + add_test(NAME ${exe_name} + COMMAND ${CMAKE_COMMAND} + -DCMD:STRING=$ + -DCIN:STRING=${cin_file} + -P "${CGAL_MODULES_DIR}/run_test_with_cin.cmake") + # message(STATUS "add test: ${exe_name} < ${cin_file}") + else() + # TODO: deal with shell globbing; if the `cmd` file contains + # a `*`, then interprete the command using bash. + if(ARGV2) + set(cmd_file "${CGAL_CURRENT_SOURCE_DIR}/${ARGV2}.cmd") + elseif(ARGV1 AND NOT EXISTS ${cmd_file}) + set(cmd_file "${CGAL_CURRENT_SOURCE_DIR}/${ARGV1}.cmd") + elseif(NOT EXISTS ${cmd_file}) + set(cmd_file "${CGAL_CURRENT_SOURCE_DIR}/${exe_name}.cmd") + endif() + if(EXISTS ${cmd_file}) + file(STRINGS "${cmd_file}" CMD_LINES) + set(ARGS) + # message(STATUS "DEBUG test ${exe_name}") + foreach(CMD_LINE ${CMD_LINES}) + # message(STATUS " command line: ${CMD_LINE}") + separate_arguments(CMD_LINE_ARGS UNIX_COMMAND ${CMD_LINE}) + # message(STATUS " args: ${CMD_LINE_ARGS}") + list(APPEND ARGS ${CMD_LINE_ARGS}) + endforeach() + expand_list_with_globbing(ARGS) + endif() + # message(STATUS "add test: ${exe_name} ${ARGS}") + add_test(NAME ${exe_name} COMMAND ${exe_name} ${ARGS}) + endif() + set_property(TEST "${exe_name}" + APPEND PROPERTY LABELS "${PROJECT_NAME}") + # message(STATUS " working dir: ${CGAL_CURRENT_SOURCE_DIR}") + set_property(TEST "${exe_name}" + PROPERTY WORKING_DIRECTORY ${CGAL_CURRENT_SOURCE_DIR}) + + return() + + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cin") + set(ARGS "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cin") + elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ARGV2}.cmd") + file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/${ARGV2}.cmd" + ARGS LIMIT_COUNT 1) + elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ARGV1}.cmd") + file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/${ARGV1}.cmd" + ARGS LIMIT_COUNT 1) + elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cmd") + file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/${exe_name}.cmd" + ARGS LIMIT_COUNT 1) + # TODO: handle multi-lines .cmd files + # see https://github.com/CGAL/cgal/pull/1295/files/c65d3abe17bb3e677b8077996cdaf8672f9c4c6f#r71705451 + endif() + string(REPLACE ";" " " args_str "${ARGS}") + add_test(NAME ${exe_name} + COMMAND ${exe_name} ${ARGS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + set_property(TEST "${exe_name}" + APPEND PROPERTY LABELS "${PROJECT_NAME}") +endfunction() From 0511bc8b698d7e33f64fe1713cd8167f8222597c Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 8 Sep 2016 16:51:47 +0200 Subject: [PATCH 09/14] CTest Arr_2: improve the name of targets --- .../Arrangement_on_surface_2/cgal_test.cmake | 63 ++++++++----------- 1 file changed, 25 insertions(+), 38 deletions(-) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake index 1e849088932..657c43113c1 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake @@ -126,15 +126,16 @@ set(TRIM 35) # configure #---------------------------------------------------------------------# -function(configure) +function(configure type) cgal_debug_message(STATUS "---> cmake with -DCGAL_CXX_FLAGS:STRING=\"${TESTSUITE_CXXFLAGS}\"") - string(REPLACE "-DTEST_" "" suffix "${TESTSUITE_CXXFLAGS}") - string(REPLACE "KERNEL" "K" suffix "${suffix}") - string(REPLACE "GEOM_TRAITS" "GT" suffix "${suffix}") - string(REPLACE "-DCGAL_ARR_POINT_LOCATION" "POINT_LOCATION" suffix "${suffix}") - string(MAKE_C_IDENTIFIER "${suffix}" suffix) - cgal_debug_message(STATUS " suffix: ${suffix}") - set(suffix ${suffix} PARENT_SCOPE) +# string(REPLACE "-DTEST_" "" suffix "${TESTSUITE_CXXFLAGS}") +# string(REPLACE "KERNEL" "K" suffix "${suffix}") +# string(REPLACE "GEOM_TRAITS" "GT" suffix "${suffix}") +# string(REPLACE "-DCGAL_ARR_POINT_LOCATION" "POINT_LOCATION" suffix "${suffix}") +# string(MAKE_C_IDENTIFIER "${suffix}" suffix) +# cgal_debug_message(STATUS " suffix: ${suffix}") +# set(suffix ${suffix} PARENT_SCOPE) + set(suffix ${type} PARENT_SCOPE) # if eval 'cmake "${CMAKE_GENERATOR}" -DRUNNING_CGAL_AUTO_TEST=TRUE \ # -DCGAL_DIR="${CGAL_DIR}" \ # -DCGAL_CXX_FLAGS:STRING="${TESTSUITE_CXXFLAGS} -I../../include" \ @@ -154,7 +155,11 @@ function(compile_test_with_flags name type flags) set(TESTSUITE_CXXFLAGS "${flags}" PARENT_SCOPE) # message(" successful configuration") # message(" successful compilation of ${name} ${type}") - configure() + if(ARGV3) + configure(${ARGV3}) + else() + configure(${type}) + endif() set(suffix ${suffix} PARENT_SCOPE) # set(suffix ${type}) cgal_arr_2_add_target(${name} ${name}.cpp) @@ -242,19 +247,11 @@ function(run_test_alt name datafile) endif() cgal_debug_message(STATUS "# run_test_alt(${ARGN})") cgal_debug_message(STATUS "# -> ./${name} ${datafile} ${ARGN}") - if(new_structure) - set(infix " (NEW)") - elseif(old_structure) - set(infix " (OLD)") - else() - set(infix " ") - endif() set(command ${name} ${datafile} ${ARGN}) - string(MAKE_C_IDENTIFIER "${name}${infix} ${ARGV4} ${ARGV5}" test_name) -# string(MAKE_C_IDENTIFIER "${command}" test_name) + string(MAKE_C_IDENTIFIER "${name} ${ARGV4} ${ARGV5}" test_name) add_test(NAME ${test_name} COMMAND ${command} WORKING_DIRECTORY ${CGAL_CURRENT_SOURCE_DIR}) -# message(" successful execution of ${name}${infix} ${ARGV4} ${ARGV5}") +# message(" successful execution of ${name} ${ARGV4} ${ARGV5}") set_property(TEST "${test_name}" APPEND PROPERTY LABELS "${PROJECT_NAME}") cgal_debug_message(STATUS "add test \"${test_name}\": ${name} ${datafile} ${ARGN}") @@ -311,9 +308,6 @@ function(execute_commands_old_structure data_dir traits_type_name) # the old structure is default, so this function executes all commands # except the commands that are given as arguments - set(new_structure FALSE) - set(old_structure TRUE) - set(commands_indicator_COMPARE 1) set(commands_indicator_VERTEX 1) set(commands_indicator_IS_VERTICAL 1) @@ -406,9 +400,6 @@ function(execute_commands_new_structure data_dir traits_type_name) # the new structure is not default, so this function executes only # commands that are given as arguments - set(new_structure TRUE) - set(old_structure FALSE) - set(commands_indicator_COMPARE 0) set(commands_indicator_VERTEX 0) set(commands_indicator_IS_VERTICAL 0) @@ -728,12 +719,8 @@ endfunction() #---------------------------------------------------------------------# # compile and run test with traits #---------------------------------------------------------------------# -function(compile_and_run_with_flags) - set(name ${ARGV0}) - set(type ${ARGV1}) - set(flags ${ARGV2}) - - compile_test_with_flags( ${name} ${type} "${flags}") +function(compile_and_run_with_flags name type flags) + compile_test_with_flags( ${name} ${type} "${flags}" ${ARGN}) # if [ -n "${SUCCESS}" ] ; then # if [ -n "${DO_RUN}" ] ; then run_test_with_flags( ${name} ${type}) @@ -810,7 +797,7 @@ function(test_point_location_segments) set(kernel ${CARTESIAN_KERNEL}) set(geom_traits ${SEGMENT_GEOM_TRAITS}) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") - compile_and_run_with_flags(test_point_location segments "${flags}") + compile_and_run_with_flags(test_point_location segments "${flags}" segments) endfunction() # For backward compatibility @@ -819,7 +806,7 @@ function(test_point_location_segments_version) set(kernel ${CARTESIAN_KERNEL}) set(geom_traits ${SEGMENT_GEOM_TRAITS}) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits} -DCGAL_ARR_POINT_LOCATION_VERSION=1") - compile_and_run_with_flags(test_point_location segments "${flags}") + compile_and_run_with_flags(test_point_location segments "${flags}" segments_version) endfunction() # For backward compatibility @@ -828,7 +815,7 @@ function(test_point_location_segments_conversion) set(kernel ${CARTESIAN_KERNEL}) set(geom_traits ${SEGMENT_GEOM_TRAITS}) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits} -DCGAL_ARR_POINT_LOCATION_CONVERSION") - compile_and_run_with_flags(test_point_location segments "${flags}") + compile_and_run_with_flags(test_point_location segments "${flags}" segment_conversion) endfunction() #---------------------------------------------------------------------# @@ -1418,7 +1405,7 @@ function(test_algebraic_traits_gmp) set(geom_traits ${ALGEBRAIC_GEOM_TRAITS}) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") - compile_test_with_flags(test_traits algebraic "${flags}") + compile_test_with_flags(test_traits algebraic "${flags}" algebraic_traits_gmp) # if [ -n "${SUCCESS}" ] ; then execute_commands_new_structure(algebraic algebraic_traits_gmp COMPARE COMPARE_Y_AT_X COMPARE_Y_AT_X_RIGHT COMPARE_Y_AT_X_LEFT @@ -1441,7 +1428,7 @@ function(test_algebraic_traits_leda) set(geom_traits ${ALGEBRAIC_GEOM_TRAITS}) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") - compile_test_with_flags(test_traits algebraic "${flags}") + compile_test_with_flags(test_traits algebraic "${flags}" algebraic_traits_leda) # if [ -n "${SUCCESS}" ] ; then execute_commands_new_structure(algebraic algebraic_traits_leda COMPARE COMPARE_Y_AT_X COMPARE_Y_AT_X_RIGHT COMPARE_Y_AT_X_LEFT @@ -1465,7 +1452,7 @@ function(test_algebraic_traits_core) set(geom_traits ${ALGEBRAIC_GEOM_TRAITS}) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") - compile_test_with_flags(test_traits algebraic "${flags}") + compile_test_with_flags(test_traits algebraic "${flags}" algebraic_traits_core) # if [ -n "${SUCCESS}" ] ; then execute_commands_new_structure(algebraic algebraic_traits_core COMPARE COMPARE_Y_AT_X COMPARE_Y_AT_X_RIGHT COMPARE_Y_AT_X_LEFT @@ -1478,7 +1465,7 @@ function(test_algebraic_traits_core) endfunction() -configure() +configure("") compile_and_run(construction_test_suite_generator) test_segment_traits() From 46b1008dc66fafcaf5239b271a298182566e8d95 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 8 Sep 2016 16:57:10 +0200 Subject: [PATCH 10/14] CTest Arr_2: remove commented code --- .../Arrangement_on_surface_2/cgal_test.cmake | 220 ++---------------- 1 file changed, 20 insertions(+), 200 deletions(-) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake index 657c43113c1..fc1bff2664c 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake @@ -136,17 +136,6 @@ function(configure type) # cgal_debug_message(STATUS " suffix: ${suffix}") # set(suffix ${suffix} PARENT_SCOPE) set(suffix ${type} PARENT_SCOPE) -# if eval 'cmake "${CMAKE_GENERATOR}" -DRUNNING_CGAL_AUTO_TEST=TRUE \ -# -DCGAL_DIR="${CGAL_DIR}" \ -# -DCGAL_CXX_FLAGS:STRING="${TESTSUITE_CXXFLAGS} -I../../include" \ -# -DCGAL_EXE_LINKER_FLAGS="${TESTSUITE_LDFLAGS}" \ -# -DCMAKE_BUILD_TYPE=NOTFOUND \ -# .' ; then -# -# echo " successful configuration" >> ${ERRORFILE} -# else -# echo " ERROR: configuration" >> ${ERRORFILE} -# fi endfunction() function(compile_test_with_flags name type flags) @@ -163,14 +152,6 @@ function(compile_test_with_flags name type flags) set(suffix ${suffix} PARENT_SCOPE) # set(suffix ${type}) cgal_arr_2_add_target(${name} ${name}.cpp) -# if eval '${MAKE_CMD} VERBOSE=1 -fMakefile \ -# ${name}' ; then -# echo " successful compilation of ${name} ${type}" >> ${ERRORFILE}; -# set(SUCCESS "y") -# else -# echo " ERROR: compilation of ${name} ${type}" >> ${ERRORFILE}; -# set(SUCCESS "") -# fi endfunction() function(cgal_arr_2_add_target exe_name source_file) @@ -188,25 +169,6 @@ function(run_test name) # ${ARGV0} - executable name cgal_debug_message(STATUS "# run_test(${ARGN})") cgal_arr_2_add_target(${name} ${ARGN}) -# basedata=`basename "${5}"` -# OUTPUTFILE="ProgramOutput.${ARGV0}" -# rm -f ${OUTPUTFILE} -# COMMAND="./${ARGV0}" -# if [ -f ${ARGV0}.cmd ] ; then -# COMMAND="${COMMAND} `cat ${ARGV0}.cmd`" -# fi -# if [ -f ${ARGV0}.cin ] ; then -# COMMAND="cat ${ARGV0}.cin | ${COMMAND}" -# fi -# OUTPUTFILE="${OUTPUTFILE}.${PLATFORM}" -# echo "Executing ${ARGV0} (${ARGV1}) ... " -# ulimit -t 3600 2> /dev/null -# if eval ${COMMAND} > ${OUTPUTFILE} 2>&1 ; then -# echo " successful execution of ${ARGV0}" >> ${ERRORFILE} -# else -# echo " ERROR: execution of ${ARGV0}" >> ${ERRORFILE} -# cat ${OUTPUTFILE} >> ${FULL_ERROR_DESCRIPTION_FILE} -# fi endfunction() function(run_test_with_flags) @@ -214,31 +176,6 @@ function(run_test_with_flags) # ${ARGV1} - test substring name cgal_debug_message(STATUS "# run_test_with_flags(${ARGN})") cgal_add_test(${ARGV0}_${suffix} ${ARGV0} ${ARGV0}.${ARGV1}) -# basedata=`basename "${5}"` -# OUTPUTFILE="ProgramOutput.${ARGV0}" -# rm -f ${OUTPUTFILE} -# COMMAND="./${ARGV0}" -# if [ -f ${ARGV0}.cmd ] ; then -# COMMAND="${COMMAND} `cat ${ARGV0}.cmd`" -# elif [ -f ${ARGV0}.${ARGV1}.cmd ] ; then -# COMMAND="${COMMAND} `cat ${ARGV0}.${ARGV1}.cmd`" -# OUTPUTFILE=${OUTPUTFILE}.`echo ${ARGV1} | tr '/' '.'` -# fi -# if [ -f ${ARGV0}.cin ] ; then -# COMMAND="cat ${ARGV0}.cin | ${COMMAND}" -# elif [ -f ${ARGV0}.${ARGV1}.cin ] ; then -# COMMAND="cat ${ARGV0}.${ARGV1}.cin | ${COMMAND}" -# OUTPUTFILE=${OUTPUTFILE}.`echo ${ARGV1} | tr '/' '.'` -# fi -# OUTPUTFILE="${OUTPUTFILE}.${PLATFORM}" -# echo "Executing ${ARGV0} (${ARGV1}) ... " -# ulimit -t 3600 2> /dev/null -# if eval ${COMMAND} > ${OUTPUTFILE} 2>&1 ; then -# echo " successful execution of ${ARGV0} (${ARGV1})" >> ${ERRORFILE} -# else -# echo " ERROR: execution of ${ARGV0} (${ARGV1})" >> ${ERRORFILE} -# cat ${OUTPUTFILE} >> ${FULL_ERROR_DESCRIPTION_FILE} -# fi endfunction() function(run_test_alt name datafile) @@ -255,18 +192,6 @@ function(run_test_alt name datafile) set_property(TEST "${test_name}" APPEND PROPERTY LABELS "${PROJECT_NAME}") cgal_debug_message(STATUS "add test \"${test_name}\": ${name} ${datafile} ${ARGN}") -# OUTPUTFILE=ProgramOutput.${ARGV0}.`echo ${5} | tr '/' '.'`.${6} -# #echo ****generating file ${OUTPUTFILE} -# # dirdata=`dirname "${datafile}"` -# rm -f ${OUTPUTFILE} -# COMMAND="./${ARGV0}" -# echo "Executing ${ARGV0} ${5} ${6} ... " -# if eval ${COMMAND} ${ARGV1} ${ARGV2} ${4} ${5} ${6} > ${OUTPUTFILE} 2>&1 ; then -# echo " successful execution of ${5} ${6}" >> ${ERRORFILE} -# else -# echo " ERROR: execution of ${5} ${6}" >> ${ERRORFILE} -# cat ${OUTPUTFILE} >> ${FULL_ERROR_DESCRIPTION_FILE} -# fi endfunction() function(run_trapped_test name datafile) @@ -280,21 +205,6 @@ function(compile_and_run) # message(" successful compilation of ${name}") cgal_arr_2_add_target(${name} ${name}.cpp) cgal_add_test(${name}) -# if eval '${MAKE_CMD} VERBOSE=1 -fMakefile ${ARGV0}' ; then -# echo " successful compilation of ${ARGV0}" >> ${ERRORFILE} -# SUCCESS="y" -# else -# echo " ERROR: compilation of ${ARGV0}" >> ${ERRORFILE} -# SUCCESS="" -# fi -# -# if [ -n "${DO_RUN}" ] ; then -# if [ -n "${SUCCESS}" ] ; then -# run_test ${ARGV0} -# else -# echo " ERROR: not executed ${ARGV0}" >> ${ERRORFILE} -# fi -# fi endfunction() function(execute_commands_old_structure data_dir traits_type_name) @@ -669,10 +579,6 @@ function(test_segment_traits_adaptor) execute_commands_traits_adaptor( segments segments_traits_adaptor COMPARE_Y_POSITION COMPARE_CW_AROUND_POINT COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE IS_BETWEEN_CW) -# else -# echo " ERROR: not executed test_traits_adaptor segment_traits" >> ${ERRORFILE} -# fi -# clean_tests endfunction() #---------------------------------------------------------------------# @@ -685,14 +591,10 @@ function(test_linear_traits_adaptor) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") compile_test_with_flags( test_traits_adaptor linear "${flags}") -# if [ -n "${SUCCESS}" ] ; then + execute_commands_traits_adaptor( linear linear_traits_adaptor COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE COMPARE_Y_POSITION IS_BETWEEN_CW COMPARE_CW_AROUND_POINT) -# else -# echo " ERROR: not executed test_traits_adaptor linear_traits" >> ${ERRORFILE} -# fi -# clean_tests endfunction() #---------------------------------------------------------------------# @@ -706,14 +608,10 @@ function(test_spherical_arcs_traits_adaptor) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits} -DTEST_TOPOL_TRAITS=${topol_traits}") compile_test_with_flags( test_traits_adaptor geodesic_arcs_on_sphere "${flags}") -# if [ -n "${SUCCESS}" ] ; then + execute_commands_traits_adaptor( spherical_arcs spherical_arcs_traits_adaptor COMPARE_Y_AT_X_LEFT ARE_MERGEABLE MERGE IS_IN_X_RANGE COMPARE_Y_POSITION IS_BETWEEN_CW COMPARE_CW_AROUND_POINT) -# else -# echo " ERROR: not executed test_traits_adaptor spherical_arcs_traits" >> ${ERRORFILE} -# fi -# clean_tests endfunction() #---------------------------------------------------------------------# @@ -929,7 +827,7 @@ function(test_segment_traits) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") compile_test_with_flags(test_traits segments "${flags}") -# if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure( segments segment_traits VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT CONSTRUCTOR COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE) @@ -940,10 +838,6 @@ function(test_segment_traits) run_trapped_test( test_traits data/segments/vertex.pt data/segments/xcurves data/empty.zero data/segments/vertex segment_traits) -# else -# echo " ERROR: not executed test_traits segment_traits" >> ${ERRORFILE} -# fi -# clean_tests endfunction() #---------------------------------------------------------------------# @@ -956,7 +850,7 @@ function(test_non_caching_segment_traits) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") compile_test_with_flags(test_traits non_caching_segments "${flags}") - # if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure(segments non_caching_segment_traits VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT CONSTRUCTOR COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE ASSERTIONS) @@ -967,10 +861,6 @@ function(test_non_caching_segment_traits) run_trapped_test(test_traits data/segments/vertex.pt data/segments/xcurves data/empty.zero data/segments/vertex non_caching_segment_traits) - # else - # echo " ERROR: not executed test_traits non_caching_segment_traits" >> ${ERRORFILE} - # fi - # clean_tests endfunction() #---------------------------------------------------------------------# @@ -984,7 +874,6 @@ function(test_polycurve_conic_traits) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") compile_test_with_flags(test_traits conic_polycurve "${flags}") -# if [ -n "${SUCCESS}" ] ; then # The input arguments for the execute_commands_new_structure, # 1. Polycurve_conics is the directory name in "data" @@ -1010,10 +899,6 @@ function(test_polycurve_conic_traits) COMPARE_ENDPOINTS_XY TRIM) -# else -# echo " ERROR: not executed test_traits polyline_traits" >> ${ERRORFILE} -# fi -# clean_tests endfunction() #---------------------------------------------------------------------# @@ -1026,7 +911,7 @@ function(test_polycurve_circular_arc_traits) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") compile_test_with_flags(test_traits circular_arc_polycurve "${flags}") -# if [ -n "${SUCCESS}" ] ; then + execute_commands_new_structure(Polycurves_circular_arcs polycurve_circular_arc_traits COMPARE_Y_AT_X EQUAL @@ -1044,11 +929,6 @@ function(test_polycurve_circular_arc_traits) MERGE COMPARE_ENDPOINTS_XY INTERSECT) - -# else -# echo " ERROR: not executed test_traits polyline_traits" >> ${ERRORFILE} -# fi -# clean_tests endfunction() #---------------------------------------------------------------------# @@ -1061,7 +941,7 @@ function(test_polycurve_bezier_traits) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") compile_test_with_flags(test_traits bezier_polycurve "${flags}") -# if [ -n "${SUCCESS}" ] ; then + execute_commands_new_structure(Polycurves_bezier test_polycurve_bezier_traits MERGE EQUAL @@ -1082,10 +962,6 @@ function(test_polycurve_bezier_traits) # INTERSECT ) -# else -# echo " ERROR: not executed test_traits polyline_traits" >> ${ERRORFILE} -# fi -# clean_tests endfunction() #---------------------------------------------------------------------# @@ -1098,14 +974,10 @@ function(test_polyline_traits) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") compile_test_with_flags(test_traits test_polylines "${flags}") -# if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure(polylines polyline_traits CONSTRUCTOR COMPARE_Y_AT_X_LEFT COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE) -# else -# echo " ERROR: not executed test_traits polyline_traits" >> ${ERRORFILE} -# fi -# clean_tests endfunction() #---------------------------------------------------------------------# @@ -1118,14 +990,10 @@ function(test_non_caching_polyline_traits) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") compile_test_with_flags(test_traits non_caching_polylines "${flags}") -# if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure(polylines non_caching_polyline_traits CONSTRUCTOR COMPARE_Y_AT_X_LEFT COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE) -# else -# echo " ERROR: not executed test_traits non_caching_polyline_traits" >> ${ERRORFILE} -# fi -# clean_tests endfunction() #---------------------------------------------------------------------# @@ -1138,7 +1006,7 @@ function(test_linear_traits) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") compile_test_with_flags(test_traits linear "${flags}") -# if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure(linear/segments linear_traits.segments VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT COMPARE_Y_AT_X_RIGHT CONSTRUCTOR ARE_MERGEABLE) @@ -1166,10 +1034,6 @@ function(test_linear_traits) SPLIT MERGE PARAMETER_SPACE_X PARAMETER_SPACE_Y COMPARE_X_AT_LIMIT COMPARE_X_NEAR_LIMIT COMPARE_Y_NEAR_BOUNDARY) -# else -# echo " ERROR: not executed test_traits linear_traits" >> ${ERRORFILE} -# fi -# clean_tests endfunction() #---------------------------------------------------------------------# @@ -1182,7 +1046,7 @@ function(test_conic_traits) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") compile_test_with_flags(test_traits conics "${flags}") -# if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure(conics conic_traits INTERSECT SPLIT MERGE COMPARE_Y_AT_X_LEFT COMPARE_Y_AT_X_RIGHT ARE_MERGEABLE) @@ -1193,10 +1057,6 @@ function(test_conic_traits) run_trapped_test(test_traits data/conics/compare.pt data/empty.zero data/empty.zero data/conics/compare conic_traits) -# else -# echo " ERROR: not executed test_traits conic_traits" >> ${ERRORFILE} -# fi -# clean_tests endfunction() #---------------------------------------------------------------------# @@ -1209,7 +1069,7 @@ function(test_line_arc_traits) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") compile_test_with_flags(test_traits line_arcs "${flags}") -# if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure(circular_lines line_arc_traits VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT ASSERTIONS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE) @@ -1224,10 +1084,6 @@ function(test_line_arc_traits) run_trapped_test(test_traits data/circular_lines/vertex.pt data/circular_lines/xcurves data/empty.zero data/circular_lines/vertex line_arc_traits) -# else -# echo " ERROR: not executed test_traits" >> ${ERRORFILE} -# fi -# clean_tests endfunction() #---------------------------------------------------------------------# @@ -1240,17 +1096,13 @@ function(test_circular_arc_traits) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") compile_test_with_flags(test_traits circular_arcs "${flags}") - # if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure(circular_arcs circular_arc_traits VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT ASSERTIONS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE) execute_commands_new_structure(circular_arcs circular_arc_traits VERTEX IS_VERTICAL COMPARE_Y_AT_X) - # else - # echo " ERROR: not executed test_traits" >> ${ERRORFILE} - # fi - # clean_tests endfunction() #---------------------------------------------------------------------# @@ -1263,7 +1115,7 @@ function(test_circular_line_arc_traits) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") compile_test_with_flags(test_traits circular_line_arcs "${flags}") - # if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure(circular_line_arcs circular_line_arc_traits VERTEX IS_VERTICAL CONSTRUCTOR COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT ASSERTIONS COMPARE_Y_AT_X_RIGHT MERGE ARE_MERGEABLE) @@ -1274,10 +1126,6 @@ function(test_circular_line_arc_traits) run_trapped_test(test_traits data/circular_line_arcs/vertex.pt data/circular_line_arcs/xcurves data/empty.zero data/circular_line_arcs/vertex circular_line_arc_traits) - # else - # echo " ERROR: not executed test_traits circular_line_arc_traits" >> ${ERRORFILE} - # fi - # clean_tests endfunction() #---------------------------------------------------------------------# @@ -1290,7 +1138,7 @@ function(test_circle_segments_traits) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") compile_test_with_flags(test_traits circle_segments "${flags}") - # if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure(circle_segments circle_segments_traits VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT COMPARE_Y_AT_X_RIGHT CONSTRUCTOR ARE_MERGEABLE) @@ -1313,10 +1161,6 @@ function(test_circle_segments_traits) run_trapped_test(test_traits data/empty.zero data/circle_segments/constructor.xcv data/empty.zero data/circle_segments/constructor circle_segments_traits) - # else - # echo " ERROR: not executed test_traits circle_segments_traits" >> ${ERRORFILE} - # fi - # clean_tests endfunction() #---------------------------------------------------------------------# @@ -1329,14 +1173,10 @@ function(test_bezier_traits) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") compile_test_with_flags(test_traits Bezier "${flags}") - # if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure(bezier bezier_traits COMPARE_Y_AT_X_LEFT COMPARE_Y_AT_X_RIGHT SPLIT CONSTRUCTOR ASSERTIONS ARE_MERGEABLE) - # else - # echo " ERROR: not executed test_traits bezier_traits" >> ${ERRORFILE} - # fi - # clean_tests endfunction() #---------------------------------------------------------------------# @@ -1350,7 +1190,7 @@ function(test_spherical_arc_traits) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits} -DTEST_TOPOL_TRAITS=${topol_traits}") compile_test_with_flags(test_traits geodesic_arcs_on_sphere "${flags}") - # if [ -n "${SUCCESS}" ] ; then + execute_commands_old_structure(spherical_arcs spherical_arc_traits COMPARE_Y_AT_X_LEFT COMPARE_Y_AT_X_RIGHT INTERSECT CONSTRUCTOR @@ -1364,10 +1204,6 @@ function(test_spherical_arc_traits) run_trapped_test(test_traits data/spherical_arcs/compare.pt data/spherical_arcs/compare.xcv data/empty.zero data/spherical_arcs/compare spherical_arc_traits) - # else - # echo " ERROR: not executed test_traits spherical_arc_traits" >> ${ERRORFILE} - # fi - # clean_tests endfunction() #---------------------------------------------------------------------# @@ -1380,7 +1216,7 @@ function(test_rational_arc_traits) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") compile_test_with_flags(test_traits rational_arcs "${flags}") - # if [ -n "${SUCCESS}" ] ; then + run_trapped_test(test_traits data/compare.pt data/empty.zero data/empty.zero data/compare rational_arc_traits) @@ -1388,10 +1224,6 @@ function(test_rational_arc_traits) execute_commands_new_structure(rational_arcs rational_arc_traits VERTEX IS_VERTICAL COMPARE_Y_AT_X COMPARE_Y_AT_X_LEFT SPLIT MERGE COMPARE_X_AT_LIMIT COMPARE_X_NEAR_LIMIT COMPARE_Y_NEAR_BOUNDARY) - # else - # echo " ERROR: not executed test_traits rational_arc_traits" >> ${ERRORFILE} - # fi - # clean_tests endfunction() #---------------------------------------------------------------------# @@ -1406,15 +1238,11 @@ function(test_algebraic_traits_gmp) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") compile_test_with_flags(test_traits algebraic "${flags}" algebraic_traits_gmp) - # if [ -n "${SUCCESS}" ] ; then + execute_commands_new_structure(algebraic algebraic_traits_gmp COMPARE COMPARE_Y_AT_X COMPARE_Y_AT_X_RIGHT COMPARE_Y_AT_X_LEFT MAKE_X_MONOTONE IS_VERTICAL VERTEX SPLIT MERGE INTERSECT PARAMETER_SPACE_X PARAMETER_SPACE_Y) - # else - # echo " ERROR: not executed test_traits algebraic_traits_gmp" >> ${ERRORFILE} - # fi - # clean_tests endfunction() #---------------------------------------------------------------------# @@ -1429,15 +1257,11 @@ function(test_algebraic_traits_leda) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") compile_test_with_flags(test_traits algebraic "${flags}" algebraic_traits_leda) - # if [ -n "${SUCCESS}" ] ; then + execute_commands_new_structure(algebraic algebraic_traits_leda COMPARE COMPARE_Y_AT_X COMPARE_Y_AT_X_RIGHT COMPARE_Y_AT_X_LEFT MAKE_X_MONOTONE IS_VERTICAL VERTEX SPLIT MERGE INTERSECT PARAMETER_SPACE_X PARAMETER_SPACE_Y) - # else - # echo " ERROR: not executed test_traits algebraic_traits_leda" >> ${ERRORFILE} - # fi - # clean_tests endfunction() @@ -1453,15 +1277,11 @@ function(test_algebraic_traits_core) set(flags "-DTEST_NT=${nt} -DTEST_KERNEL=${kernel} -DTEST_GEOM_TRAITS=${geom_traits}") compile_test_with_flags(test_traits algebraic "${flags}" algebraic_traits_core) - # if [ -n "${SUCCESS}" ] ; then + execute_commands_new_structure(algebraic algebraic_traits_core COMPARE COMPARE_Y_AT_X COMPARE_Y_AT_X_RIGHT COMPARE_Y_AT_X_LEFT MAKE_X_MONOTONE IS_VERTICAL VERTEX SPLIT MERGE INTERSECT PARAMETER_SPACE_X PARAMETER_SPACE_Y) - # else - # echo " ERROR: not executed test_traits algebraic_traits_core" >> ${ERRORFILE} - # fi - # clean_tests endfunction() From d8b564e003fe4c5364ed8fbd44c2bdc459845be7 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Tue, 20 Sep 2016 10:31:58 +0200 Subject: [PATCH 11/14] Use CGAL_add_test.cmake --- .../CGAL_CreateSingleSourceCGALProgram.cmake | 42 +------------------ 1 file changed, 1 insertion(+), 41 deletions(-) diff --git a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake index d9d222e124b..73fdc9117a6 100644 --- a/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake +++ b/Installation/cmake/modules/CGAL_CreateSingleSourceCGALProgram.cmake @@ -1,44 +1,4 @@ - -# Process a list, and replace items contains a file pattern (like -# `*.off`) by the sublist that corresponds to the globbing of the -# pattern in the directory `${CGAL_CURRENT_SOURCE_DIR}`. -# -# -# For example: the `file -# test/Poisson_surface_reconstruction_3/poisson_reconstruction_test.cmd` -# contains: -# -# data/*.off data/*.xyz data/*.pwn -# -# For that file, the list `ARGS` computed in the function -# `create_single_source_cgal_program` (see below) is the list: -# -# data/*.off;data/*.xyz;data/*.pwn -# -# A call to `expand_list_with_globbing(ARGS)` replaces the list by: -# -# data/ChineseDragon-10kv.off;data/robocat_deci.off;data/sphere_20k.xyz;data/oni.pwn" -# -function(expand_list_with_globbing list_name) - set(input_list ${${list_name}}) -# message(STATUS "expand_list_with_globbing(${list_name}), ${list_name} is: ${input_list}") - list(LENGTH input_list list_lenght) - math(EXPR list_last_n "${list_lenght} - 1") - set(output_list) - foreach(n RANGE ${list_last_n}) -# message(STATUS "n=${n}") - list(GET input_list ${n} item_n) -# message(STATUS "argument ${n} is ${item_n}") - if(item_n MATCHES ".*\\*.*") - file(GLOB files RELATIVE ${CGAL_CURRENT_SOURCE_DIR} ${item_n}) - list(APPEND output_list ${files}) - else() - list(APPEND output_list ${item_n}) - endif() -# message(STATUS " new value of the output list: ${output_list}") - endforeach() - set(${list_name} ${output_list} PARENT_SCOPE) -endfunction() +include(CGAL_add_test) function(create_single_source_cgal_program firstfile ) From adfdcdfea24d7684c5f03a3006d1e8f304432556 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Sun, 11 Sep 2016 12:32:35 +0200 Subject: [PATCH 12/14] add .travis.yml from e2bda6b04ece18b2a6e97109ddb67505b906b5ac --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 2195a02646c..a2255ecc567 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ language: cpp dist: trusty +before_install: + - sudo add-apt-repository ppa:smspillaz/cmake-2.8.12 -y install: before_script: - mkdir build From 5a1a9b7135bcb1f799525ef06d5be289f9b26695 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 21 Sep 2016 11:56:52 +0200 Subject: [PATCH 13/14] Add a compatibility with `cgal_test` --- .../test/Arrangement_on_surface_2/cgal_test.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake index fc1bff2664c..fc7e6238215 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake @@ -163,6 +163,11 @@ function(cgal_arr_2_add_target exe_name source_file) separate_arguments(flags UNIX_COMMAND "${TESTSUITE_CXXFLAGS}") target_compile_options(${name} PRIVATE ${flags}) cgal_debug_message(STATUS "# -> target ${name} with TESTSUITE_CXXFLAGS: ${flags}") + + # Add a compatibility-mode with the shell script `cgal_test_base` + if(RUNNING_CGAL_AUTO_TEST AND NOT TARGET ${exe_name}) + create_single_source_cgal_program( "${source_file}" ) + endif() endfunction() function(run_test name) From 82b25ebf61b1df1aa7efaa277b9512a4e8a8be69 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 22 Sep 2016 12:06:10 +0200 Subject: [PATCH 14/14] Add a compatibility with CMake-2.8.11. `target_compile_options` was introduced by CMake-2.8.12. With CMake-2.8.11, let's use the former `CMakeLists.txt`, instead of the new version from `cgal_test.cmake` --- .../Arrangement_on_surface_2/CMakeLists.txt | 19 +++++++++++++------ .../Arrangement_on_surface_2/cgal_test.cmake | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/CMakeLists.txt b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/CMakeLists.txt index 5970c563d22..1ca5fea8e19 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/CMakeLists.txt +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/CMakeLists.txt @@ -18,12 +18,19 @@ if ( CGAL_FOUND ) include_directories (BEFORE "../../include") - include( ${CMAKE_CURRENT_SOURCE_DIR}/cgal_test.cmake ) - # create a target per cppfile -# file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) -# foreach(cppfile ${cppfiles}) -# create_single_source_cgal_program( "${cppfile}" ) -# endforeach() + if(COMMAND target_compile_options) + # Since CMake-2.8.12: New CMake script, that defines the targets and + # the CTest test cases. + include( ${CMAKE_CURRENT_SOURCE_DIR}/cgal_test.cmake ) + else() + # If CMake version is <= 2.8.11, use the usual CMake script. + + # create a target per cppfile + file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) + foreach(cppfile ${cppfiles}) + create_single_source_cgal_program( "${cppfile}" ) + endforeach() + endif() else() diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake index fc7e6238215..110d1bfda3f 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/cgal_test.cmake @@ -165,7 +165,7 @@ function(cgal_arr_2_add_target exe_name source_file) cgal_debug_message(STATUS "# -> target ${name} with TESTSUITE_CXXFLAGS: ${flags}") # Add a compatibility-mode with the shell script `cgal_test_base` - if(RUNNING_CGAL_AUTO_TEST AND NOT TARGET ${exe_name}) + if(NOT TARGET ${exe_name}) create_single_source_cgal_program( "${source_file}" ) endif() endfunction()