diff --git a/CMakeLists.txt b/CMakeLists.txt index 7897409fd65d0427d6e9957b6e70e64d17f3158a..f80b1e012c368a7d00e0c9682103880a42367ac4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,7 +65,7 @@ ADD_SUBDIRECTORY(src) ADD_SUBDIRECTORY(include) ADD_SUBDIRECTORY(tools) ADD_SUBDIRECTORY(doc) -ADD_SUBDIRECTORY(unitTesting) +ADD_SUBDIRECTORY(tests) SETUP_PROJECT_FINALIZE() SETUP_PROJECT_CPACK() \ No newline at end of file diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..9ab6e94d4b3f007925b569e26745345cc235bacd --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,57 @@ +# Copyright 2010, Olivier Stasse, JRL, CNRS/AIST +# +# This file is part of dynamic-graph. +# dynamic-graph is free software: you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# dynamic-graph is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Lesser Public License for more details. You should have +# received a copy of the GNU Lesser General Public License along with +# dynamic-graph. If not, see <http://www.gnu.org/licenses/>. + +ADD_DEFINITIONS(-DDEBUG=2) + +# Add Boost path to include directories. +INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS}) + +# Make Boost.Test generates the main function in test cases. +ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK -DBOOST_TEST_MAIN) + +# DYNAMIC_GRAPH_TEST(NAME) +# ------------------------ +# +# Define a test named `NAME'. +# +# This macro will create a binary from `NAME.cpp', link it against +# Boost and add it to the test suite. +# +MACRO(DYNAMIC_GRAPH_TEST NAME) + ADD_EXECUTABLE(${NAME} ${NAME}.cpp) + ADD_TEST(${NAME} ${RUNTIME_OUTPUT_DIRECTORY}/${NAME}) + + TARGET_LINK_LIBRARIES(${NAME} ${PROJECT_NAME}) + ADD_DEPENDENCIES(${NAME} ${PROJECT_NAME}) + + # Link against Boost. + TARGET_LINK_LIBRARIES(${NAME} ${Boost_LIBRARIES}) +ENDMACRO(DYNAMIC_GRAPH_TEST) + +DYNAMIC_GRAPH_TEST(test_pool) +DYNAMIC_GRAPH_TEST(test_depend) + + +# Signal cast test. +SET(signalcast_libs test_signalcast_libA test_signalcast_libB) + +FOREACH(lib ${signalcast_libs}) + ADD_LIBRARY(${lib} SHARED ${lib}.cpp) + + TARGET_LINK_LIBRARIES(${lib} ${PROJECT_NAME}) + ADD_DEPENDENCIES(${lib} ${PROJECT_NAME}) +ENDFOREACH() +DYNAMIC_GRAPH_TEST(test_signalcast) +TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} ${signalcast_libs}) diff --git a/unitTesting/test_depend.cpp b/tests/test_depend.cpp similarity index 100% rename from unitTesting/test_depend.cpp rename to tests/test_depend.cpp diff --git a/unitTesting/test_pool.cpp b/tests/test_pool.cpp similarity index 100% rename from unitTesting/test_pool.cpp rename to tests/test_pool.cpp diff --git a/unitTesting/test_signalcast.cpp b/tests/test_signalcast.cpp similarity index 100% rename from unitTesting/test_signalcast.cpp rename to tests/test_signalcast.cpp diff --git a/unitTesting/test_signalcast_libA.cpp b/tests/test_signalcast_libA.cpp similarity index 100% rename from unitTesting/test_signalcast_libA.cpp rename to tests/test_signalcast_libA.cpp diff --git a/unitTesting/test_signalcast_libA.h b/tests/test_signalcast_libA.h similarity index 100% rename from unitTesting/test_signalcast_libA.h rename to tests/test_signalcast_libA.h diff --git a/unitTesting/test_signalcast_libB.cpp b/tests/test_signalcast_libB.cpp similarity index 100% rename from unitTesting/test_signalcast_libB.cpp rename to tests/test_signalcast_libB.cpp diff --git a/unitTesting/test_signalcast_libB.h b/tests/test_signalcast_libB.h similarity index 100% rename from unitTesting/test_signalcast_libB.h rename to tests/test_signalcast_libB.h diff --git a/unitTesting/CMakeLists.txt b/unitTesting/CMakeLists.txt deleted file mode 100644 index 96a4ebcb73cf41323781147bc7d24e3355631010..0000000000000000000000000000000000000000 --- a/unitTesting/CMakeLists.txt +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright 2010, Olivier Stasse, JRL, CNRS/AIST -# -# This file is part of dynamic-graph. -# dynamic-graph is free software: you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public License -# as published by the Free Software Foundation, either version 3 of -# the License, or (at your option) any later version. -# -# dynamic-graph is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Lesser Public License for more details. You should have -# received a copy of the GNU Lesser General Public License along with -# dynamic-graph. If not, see <http://www.gnu.org/licenses/>. - -# Declare boost include directories -include_directories(${Boost_INCLUDE_DIRS}) - -### tests -SET(tests_exe - test_pool - test_depend - test_signalcast) - -SET(tests_libs - test_signalcast_libA - test_signalcast_libB -) - -SET(test_signalcast_additional_libs ${test_libs}) - -ADD_DEFINITIONS(-DDEBUG=2) - -LINK_DIRECTORIES(${CMAKE_SOURCE_DIR}/src) - -# Additional tests -FOREACH(test_name ${tests_libs}) - SET(LIBRARY_NAME ${test_name}) - - ADD_LIBRARY(${LIBRARY_NAME} - SHARED - ${test_name}.cpp) - - TARGET_LINK_LIBRARIES(${LIBRARY_NAME} - ${PROJECT_NAME}) - ADD_DEPENDENCIES(${LIBRARY_NAME} - ${PROJECT_NAME}) -ENDFOREACH(test_name) - -FOREACH(test_name ${tests_exe}) - SET(EXECUTABLE_NAME ${test_name}) - - ADD_EXECUTABLE(${EXECUTABLE_NAME} - ${test_name}.cpp) - - TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} - ${PROJECT_NAME}) - ADD_DEPENDENCIES(${EXECUTABLE_NAME} - ${PROJECT_NAME}) - - TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME} - ${${test_name}_additional_libs}) - - ADD_TEST(NAME ${test_name} COMMAND ${test_name}) -ENDFOREACH(test_name)