diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2015-04-08 11:24:02 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2015-04-08 11:24:02 +0000 |
commit | a242702ce22f379e11708cbf32a7e7433c4c5d01 (patch) | |
tree | bf5dd9418dbc877ad40414d724fb1027d0906f9f /src/Bottleneck | |
parent | eaae83fc6b471bb05891addd35863fe00c351565 (diff) | |
parent | cb457ffb26e05ed619eb55676ae6d569f7497284 (diff) |
backmerge of last trunk modification
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/bottleneckDistance@552 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: 1c2b73b7bee36af96a3a9c445a7722e2921f43d7
Diffstat (limited to 'src/Bottleneck')
-rw-r--r-- | src/Bottleneck/include/gudhi/Persistence_diagrams_graph.h | 16 | ||||
-rw-r--r-- | src/Bottleneck/test/CMakeLists.txt | 32 |
2 files changed, 26 insertions, 22 deletions
diff --git a/src/Bottleneck/include/gudhi/Persistence_diagrams_graph.h b/src/Bottleneck/include/gudhi/Persistence_diagrams_graph.h index 8e9eaaf6..105f9059 100644 --- a/src/Bottleneck/include/gudhi/Persistence_diagrams_graph.h +++ b/src/Bottleneck/include/gudhi/Persistence_diagrams_graph.h @@ -34,7 +34,7 @@ namespace Gudhi { namespace bottleneck { // Diagram_point is the type of the persistence diagram's points -typedef typename std::pair<double, double> Diagram_point; +typedef std::pair<double, double> Diagram_point; // Return the used index for encoding none of the points int null_point_index(); @@ -82,7 +82,7 @@ Persistence_diagrams_graph::Persistence_diagrams_graph(const Persistence_diagram swap(u, v); } -Persistence_diagrams_graph::Persistence_diagrams_graph::Persistence_diagrams_graph() +Persistence_diagrams_graph::Persistence_diagrams_graph() : u(), v() { } inline bool Persistence_diagrams_graph::on_the_u_diagonal(int u_point_index) const { @@ -104,12 +104,12 @@ inline int Persistence_diagrams_graph::corresponding_point_in_v(int u_point_inde } inline double Persistence_diagrams_graph::distance(int u_point_index, int v_point_index) const { - // could be optimized for the case where one point is the projection of the other - if (on_the_u_diagonal(u_point_index) && on_the_v_diagonal(v_point_index)) - return 0; - Diagram_point p_u = get_u_point(u_point_index); - Diagram_point p_v = get_v_point(v_point_index); - return std::max(std::fabs(p_u.first - p_v.first), std::fabs(p_u.second - p_v.second)); + // could be optimized for the case where one point is the projection of the other + if (on_the_u_diagonal(u_point_index) && on_the_v_diagonal(v_point_index)) + return 0; + Diagram_point p_u = get_u_point(u_point_index); + Diagram_point p_v = get_v_point(v_point_index); + return (std::max)(std::fabs(p_u.first - p_v.first), std::fabs(p_u.second - p_v.second)); } inline int Persistence_diagrams_graph::size() const { diff --git a/src/Bottleneck/test/CMakeLists.txt b/src/Bottleneck/test/CMakeLists.txt index 7044372e..3dfd80cd 100644 --- a/src/Bottleneck/test/CMakeLists.txt +++ b/src/Bottleneck/test/CMakeLists.txt @@ -1,21 +1,25 @@ cmake_minimum_required(VERSION 2.6) -project(GUDHIBottleneckUnitTest) +project(GUDHIBottleneckUT) -if(NOT MSVC) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --coverage") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} --coverage") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} --coverage") +if (GCOVR_PATH) + # for gcovr to make coverage reports - Corbera Jenkins plugin + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-arcs -ftest-coverage") +endif() +if (GPROF_PATH) + # for gprof to make coverage reports - Jenkins + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -pg") endif() -add_executable ( BottleneckUnitTest bottleneck_unit_test.cpp ) -target_link_libraries(BottleneckUnitTest ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) +add_executable ( BottleneckUT bottleneck_unit_test.cpp ) +target_link_libraries(BottleneckUT ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}) # Unitary tests -add_test(BottleneckUnitTest ${CMAKE_CURRENT_BINARY_DIR}/BottleneckUnitTest) - -if (LCOV_PATH) - # Lcov code coverage of unitary test - add_test(src/Bottleneck/lcov/coverage.log ${CMAKE_SOURCE_DIR}/scripts/check_code_coverage.sh ${CMAKE_SOURCE_DIR}/src/Bottleneck) -endif() +add_test(NAME BottleneckUT + COMMAND ${CMAKE_CURRENT_BINARY_DIR}/BottleneckUT + # XML format for Jenkins xUnit plugin + --log_format=XML --log_sink=${CMAKE_SOURCE_DIR}/BottleneckUT.xml --log_level=test_suite --report_level=no) -cpplint_add_tests("${CMAKE_SOURCE_DIR}/src/Bottleneck/include/gudhi") |