1 add_custom_target (tests)
3 # have to add timer.c and mt19937ar.c as symbols are declared extern
4 add_executable (testopt EXCLUDE_FROM_ALL testfuncs.c testfuncs.h testopt.cpp ${CMAKE_SOURCE_DIR}/util/timer.c ${CMAKE_SOURCE_DIR}/util/mt19937ar.c)
5 target_link_libraries (testopt ${nlopt_lib})
6 add_dependencies (tests testopt)
8 foreach (algo_index RANGE 29)# 42
9 foreach (obj_index RANGE 1)# 21
13 if (algo_index STREQUAL 8 OR algo_index STREQUAL 9)
18 if (algo_index STREQUAL 10)
22 add_test (NAME testopt_algo${algo_index}_obj${obj_index} COMMAND testopt -a ${algo_index} -o ${obj_index})
27 if (NUMPY_FOUND AND PYTHONLIBS_FOUND AND (SWIG_FOUND OR (EXISTS ${CMAKE_SOURCE_DIR}/swig/nlopt-python.cpp)))
28 set (PYINSTALLCHECK_ENVIRONMENT "LD_LIBRARY_PATH=${INSTALL_DESTDIR}${INSTALL_LIB_DIR}:$ENV{LD_LIBRARY_PATH}"
29 "PYTHONPATH=${INSTALL_DESTDIR}${CMAKE_INSTALL_PREFIX}/${PYTHON_MODULE_PATH}${PATH_SEP}$ENV{PYTHONPATH}"
31 add_test (NAME test_std_python COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test_std.py)
32 set_tests_properties (test_std_python PROPERTIES ENVIRONMENT "${PYINSTALLCHECK_ENVIRONMENT}")