From 3d36fe05b3ca13d11b2b46afd1c89d64a9f0a32e Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Wed, 7 Sep 2016 16:14:00 +0200 Subject: [PATCH] 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()