From d620386a7b64db926d08afb32b84ca70c7835cca Mon Sep 17 00:00:00 2001 From: Frank Celler Date: Sun, 20 Oct 2013 18:46:40 +0200 Subject: [PATCH] added tests --- CMakeLists.txt | 20 +++++-- UnitTests/CMakeLists.txt | 113 +++++++++++++++++++++++++++++++++++++++ arangod/CMakeLists.txt | 6 +++ arangoirb/CMakeLists.txt | 6 +++ arangosh/CMakeLists.txt | 6 +++ 5 files changed, 148 insertions(+), 3 deletions(-) create mode 100644 UnitTests/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index eb8794e22e..470bfc4c8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,8 @@ set(BIN_ARANGOIRB arangoirb) set(BIN_ARANGORESTORE arangorestore) set(BIN_ARANGOSH arangosh) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/") +set(TEST_BASICS_SUITE basics_suite) +set(TEST_GEO_SUITE geo_suite) ################################################################################ ### @brief threads @@ -43,11 +44,12 @@ find_package(Threads) ################################################################################ if (CMAKE_COMPILER_IS_GNUCC) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu89") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu89 -g") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -g") endif () if (CMAKE_COMPILER_IS_GNUCXX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98 -g") endif () if (APPLE) @@ -71,6 +73,10 @@ add_definitions("-DTRI_BITS=${BITS}") option(USE_MRUBY "Do you want to use MRUBY" OFF) +if (USE_MRUBY) + add_definitions("-DTRI_ENABLE_MRUBY=1") +endif () + ################################################################################ ### @brief SYSTEM CONFIGURATION DIRECTORY (/etc) ################################################################################ @@ -238,6 +244,14 @@ if (USE_MRUBY) add_subdirectory(arangoirb) endif () +## ----------------------------------------------------------------------------- +## --SECTION-- TESTS +## ----------------------------------------------------------------------------- + +enable_testing() + +add_subdirectory(UnitTests) + ## ----------------------------------------------------------------------------- ## --SECTION-- PACKAGES ## ----------------------------------------------------------------------------- diff --git a/UnitTests/CMakeLists.txt b/UnitTests/CMakeLists.txt new file mode 100644 index 0000000000..e127b9055d --- /dev/null +++ b/UnitTests/CMakeLists.txt @@ -0,0 +1,113 @@ +# -*- mode: CMAKE; -*- + +## ----------------------------------------------------------------------------- +## --SECTION-- COMMON INCLUDES +## ----------------------------------------------------------------------------- + +include_directories(.) +include_directories(${PROJECT_SOURCE_DIR}/lib) +include_directories(${PROJECT_SOURCE_DIR}/arangod) + +## ----------------------------------------------------------------------------- +## --SECTION-- BOOST FRAMEWORK +## ----------------------------------------------------------------------------- + +################################################################################ +### @brief BOOST unit-test framework +################################################################################ + +find_package(Boost COMPONENTS unit_test_framework) + +## ----------------------------------------------------------------------------- +## --SECTION-- TEST EXECUTABLES +## ----------------------------------------------------------------------------- + +################################################################################ +### @brief output directory +################################################################################ + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/tests/") + +################################################################################ +### @brief basics_suite +################################################################################ + +if (Boost_UNIT_TEST_FRAMEWORK_FOUND) + +add_executable( + ${TEST_BASICS_SUITE} + Runner.cpp + Philadelphia/conversions-test.cpp + Philadelphia/csv-test.cpp + Philadelphia/files-test.cpp + Philadelphia/json-test.cpp + Philadelphia/json-utilities-test.cpp + Philadelphia/hashes-test.cpp + Philadelphia/mersenne-test.cpp + Philadelphia/associative-pointer-test.cpp + Philadelphia/associative-synced-test.cpp + Philadelphia/string-buffer-test.cpp + Philadelphia/string-utf8-normalize-test.cpp + Philadelphia/string-utf8-test.cpp + Philadelphia/string-test.cpp + Philadelphia/structure-size-test.cpp + Philadelphia/vector-pointer-test.cpp + Philadelphia/vector-test.cpp + Jutland/EndpointTest.cpp + Jutland/StringBufferTest.cpp + Jutland/StringUtilsTest.cpp +) + +target_link_libraries( + ${TEST_BASICS_SUITE} + ${LIB_ARANGO} + ${ICU_LIBS} + ${OPENSSL_LIBS} + ${ZLIB_LIBS} + ${Boost_LIBRARIES} +) + +add_test( + basics + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TEST_BASICS_SUITE} +) + +endif () + +################################################################################ +### @brief geo_suite +################################################################################ + +if (Boost_UNIT_TEST_FRAMEWORK_FOUND) + +add_executable( + ${TEST_GEO_SUITE} + Cambridge/Runner.cpp + Cambridge/georeg.cpp + ../arangod/GeoIndex/GeoIndex.c +) + +target_link_libraries( + ${TEST_GEO_SUITE} + ${LIB_ARANGO} + ${ICU_LIBS} + ${OPENSSL_LIBS} + ${ZLIB_LIBS} + ${Boost_LIBRARIES} +) + +add_test( + geo + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TEST_GEO_SUITE} +) + +endif () + +## ----------------------------------------------------------------------------- +## --SECTION-- END-OF-FILE +## ----------------------------------------------------------------------------- + +## Local Variables: +## mode: outline-minor +## outline-regexp: "^\\(### @brief\\|## --SECTION--\\|# -\\*- \\)" +## End: diff --git a/arangod/CMakeLists.txt b/arangod/CMakeLists.txt index e850cd7f1f..7efaf14925 100644 --- a/arangod/CMakeLists.txt +++ b/arangod/CMakeLists.txt @@ -11,6 +11,12 @@ include_directories(${PROJECT_SOURCE_DIR}/lib) ## --SECTION-- EXECUTABLES ## ----------------------------------------------------------------------------- +################################################################################ +### @brief output directory +################################################################################ + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/") + ################################################################################ ### @brief arangod ################################################################################ diff --git a/arangoirb/CMakeLists.txt b/arangoirb/CMakeLists.txt index bd3b3d7e02..c71afea217 100644 --- a/arangoirb/CMakeLists.txt +++ b/arangoirb/CMakeLists.txt @@ -12,6 +12,12 @@ include_directories(${PROJECT_SOURCE_DIR}/arangosh) ## --SECTION-- EXECUTABLES ## ----------------------------------------------------------------------------- +################################################################################ +### @brief output directory +################################################################################ + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/") + ################################################################################ ### @brief arangoirb ################################################################################ diff --git a/arangosh/CMakeLists.txt b/arangosh/CMakeLists.txt index 5b110486e1..7dd535cc05 100644 --- a/arangosh/CMakeLists.txt +++ b/arangosh/CMakeLists.txt @@ -11,6 +11,12 @@ include_directories(${PROJECT_SOURCE_DIR}/lib) ## --SECTION-- EXECUTABLES ## ----------------------------------------------------------------------------- +################################################################################ +### @brief output directory +################################################################################ + +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/") + ################################################################################ ### @brief arangob ################################################################################