Add basic facades for Customizer and Partitioner run methods

This commit is contained in:
Mateusz Loskot
2018-02-02 13:13:15 +01:00
committed by Patrick Niklaus
parent 30ed1fae99
commit c6d12e064c
10 changed files with 272 additions and 4 deletions
+28 -2
View File
@@ -25,7 +25,11 @@ file(GLOB UpdaterTestsSources
file(GLOB LibraryTestsSources
library_tests.cpp
library/*.cpp)
list(REMOVE_ITEM LibraryTestsSources ${CMAKE_CURRENT_SOURCE_DIR}/library/extract.cpp ${CMAKE_CURRENT_SOURCE_DIR}/library/contract.cpp)
list(REMOVE_ITEM LibraryTestsSources
${CMAKE_CURRENT_SOURCE_DIR}/library/contract.cpp
${CMAKE_CURRENT_SOURCE_DIR}/library/customize.cpp
${CMAKE_CURRENT_SOURCE_DIR}/library/extract.cpp
${CMAKE_CURRENT_SOURCE_DIR}/library/partition.cpp)
file(GLOB LibraryExtractTestsSources
library_tests.cpp
@@ -35,6 +39,14 @@ file(GLOB LibraryContractTestsSources
library_tests.cpp
library/contract.cpp)
file(GLOB LibraryCustomizeTestsSources
library_tests.cpp
library/customize.cpp)
file(GLOB LibraryPartitionTestsSources
library_tests.cpp
library/partition.cpp)
file(GLOB ServerTestsSources
server_tests.cpp
server/*.cpp)
@@ -85,6 +97,14 @@ add_executable(library-contract-tests
EXCLUDE_FROM_ALL
${LibraryContractTestsSources})
add_executable(library-customize-tests
EXCLUDE_FROM_ALL
${LibraryCustomizeTestsSources})
add_executable(library-partition-tests
EXCLUDE_FROM_ALL
${LibraryPartitionTestsSources})
add_executable(server-tests
EXCLUDE_FROM_ALL
${ServerTestsSources}
@@ -112,6 +132,8 @@ target_compile_definitions(extractor-tests PRIVATE COMPILE_DEFINITIONS OSRM_FIXT
target_compile_definitions(library-tests PRIVATE COMPILE_DEFINITIONS OSRM_TEST_DATA_DIR="${TEST_DATA_DIR}")
target_compile_definitions(library-extract-tests PRIVATE COMPILE_DEFINITIONS OSRM_TEST_DATA_DIR="${TEST_DATA_DIR}")
target_compile_definitions(library-contract-tests PRIVATE COMPILE_DEFINITIONS OSRM_TEST_DATA_DIR="${TEST_DATA_DIR}")
target_compile_definitions(library-customize-tests PRIVATE COMPILE_DEFINITIONS OSRM_TEST_DATA_DIR="${TEST_DATA_DIR}")
target_compile_definitions(library-partition-tests PRIVATE COMPILE_DEFINITIONS OSRM_TEST_DATA_DIR="${TEST_DATA_DIR}")
target_compile_definitions(updater-tests PRIVATE COMPILE_DEFINITIONS TEST_DATA_DIR="${UPDATER_TEST_DATA_DIR}")
target_compile_definitions(contractor-tests PRIVATE COMPILE_DEFINITIONS TEST_DATA_DIR="${TEST_DATA_DIR}")
@@ -119,6 +141,8 @@ target_include_directories(engine-tests PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(library-tests PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(library-extract-tests PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(library-contract-tests PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(library-customize-tests PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(library-partition-tests PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(util-tests PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(partitioner-tests PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(customizer-tests PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
@@ -133,9 +157,11 @@ target_link_libraries(updater-tests ${UPDATER_LIBRARIES} ${Boost_UNIT_TEST_FRAME
target_link_libraries(library-tests osrm ${ENGINE_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
target_link_libraries(library-extract-tests osrm_extract ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
target_link_libraries(library-contract-tests osrm_contract ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
target_link_libraries(library-customize-tests osrm_customize ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
target_link_libraries(library-partition-tests osrm_partition ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
target_link_libraries(server-tests osrm ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
target_link_libraries(util-tests ${UTIL_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
target_link_libraries(contractor-tests ${CONTRACTOR_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
add_custom_target(tests
DEPENDS engine-tests extractor-tests contractor-tests partitioner-tests updater-tests customizer-tests library-tests library-extract-tests server-tests util-tests)
DEPENDS engine-tests extractor-tests contractor-tests partitioner-tests updater-tests customizer-tests library-tests library-extract-tests library-contract-tests library-customize-tests library-partition-tests server-tests util-tests)
+21
View File
@@ -0,0 +1,21 @@
#include <boost/test/test_case_template.hpp>
#include <boost/test/unit_test.hpp>
#include "osrm/customizer.hpp"
#include "osrm/customizer_config.hpp"
#include <tbb/task_scheduler_init.h> // default_num_threads
BOOST_AUTO_TEST_SUITE(library_customize)
BOOST_AUTO_TEST_CASE(test_customize_with_invalid_config)
{
using namespace osrm;
osrm::CustomizationConfig config;
config.requested_num_threads = tbb::task_scheduler_init::default_num_threads();
BOOST_CHECK_THROW(osrm::customize(config),
std::exception); // including osrm::util::exception, etc.
}
BOOST_AUTO_TEST_SUITE_END()
+21
View File
@@ -0,0 +1,21 @@
#include <boost/test/test_case_template.hpp>
#include <boost/test/unit_test.hpp>
#include "osrm/partitioner.hpp"
#include "osrm/partitioner_config.hpp"
#include <tbb/task_scheduler_init.h> // default_num_threads
BOOST_AUTO_TEST_SUITE(library_partition)
BOOST_AUTO_TEST_CASE(test_partition_with_invalid_config)
{
using namespace osrm;
osrm::PartitionerConfig config;
config.requested_num_threads = tbb::task_scheduler_init::default_num_threads();
BOOST_CHECK_THROW(osrm::partition(config),
std::exception); // including osrm::util::exception, etc.
}
BOOST_AUTO_TEST_SUITE_END()