diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2014-12-10 16:09:31 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2014-12-10 16:09:31 +0000 |
commit | c97ef32a8f8959c3ad67543a5e22fb6e1a82cda5 (patch) | |
tree | 8a905d77677c33dc5d42dfed63aedc5ca13b33cf /src | |
parent | 429d4f06cede4d97144592eff91689fc1c707474 (diff) |
Add examples in tests
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cpplint_test@347 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: a53767f02ba413531d397ebf720d87ed9d832a79
Diffstat (limited to 'src')
-rw-r--r-- | src/Persistent_cohomology/example/CMakeLists.txt | 13 | ||||
-rw-r--r-- | src/Persistent_cohomology/test/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/Simplex_tree/example/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/Simplex_tree/example/simple_simplex_tree.cpp | 13 | ||||
-rw-r--r-- | src/Simplex_tree/include/gudhi/Simplex_tree.h | 6 | ||||
-rw-r--r-- | src/Simplex_tree/test/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/Simplex_tree/test/simplex_tree_unit_test.cpp | 13 |
7 files changed, 35 insertions, 22 deletions
diff --git a/src/Persistent_cohomology/example/CMakeLists.txt b/src/Persistent_cohomology/example/CMakeLists.txt index dca4a04d..98213545 100644 --- a/src/Persistent_cohomology/example/CMakeLists.txt +++ b/src/Persistent_cohomology/example/CMakeLists.txt @@ -5,18 +5,25 @@ project(GUDHIExPersCohom) find_package(Boost 1.45.0 COMPONENTS system program_options) message("Boost_lib = ${Boost_LIBRARIES}") -add_executable ( rips_persistence rips_persistence.cpp ) +add_executable(rips_persistence rips_persistence.cpp) target_link_libraries(rips_persistence ${Boost_LIBRARIES}) -add_executable ( rips_persistence_from_alpha_shape_3 rips_persistence_from_alpha_shape_3.cpp ) +add_test(rips_persistence_2 ${CMAKE_CURRENT_BINARY_DIR}/rips_persistence ${CMAKE_SOURCE_DIR}/data/points/Kl.txt -r 0.25 -d 3 -p 2 -m 100) +add_test(rips_persistence_3 ${CMAKE_CURRENT_BINARY_DIR}/rips_persistence ${CMAKE_SOURCE_DIR}/data/points/Kl.txt -r 0.25 -d 3 -p 3 -m 100) + +add_executable(rips_persistence_from_alpha_shape_3 rips_persistence_from_alpha_shape_3.cpp ) target_link_libraries(rips_persistence_from_alpha_shape_3 ${Boost_LIBRARIES}) if(GMPXX_FOUND AND GMP_FOUND) message("GMPXX_LIBRARIES = ${GMPXX_LIBRARIES}") message("GMP_LIBRARIES = ${GMP_LIBRARIES}") - add_executable ( rips_multifield_persistence rips_multifield_persistence.cpp ) + add_executable(rips_multifield_persistence rips_multifield_persistence.cpp ) target_link_libraries(rips_multifield_persistence ${Boost_LIBRARIES} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES}) + add_test(rips_multifield_persistence_2_3 ${CMAKE_CURRENT_BINARY_DIR}/rips_multifield_persistence ${CMAKE_SOURCE_DIR}/data/points/Kl.txt -r 0.25 -d 3 -p 2 -q 3 -m 100) + add_test(rips_multifield_persistence_2_71 ${CMAKE_CURRENT_BINARY_DIR}/rips_multifield_persistence ${CMAKE_SOURCE_DIR}/data/points/Kl.txt -r 0.25 -d 3 -p 2 -q 71 -m 100) add_executable ( performance_rips_persistence performance_rips_persistence.cpp ) target_link_libraries(performance_rips_persistence ${Boost_LIBRARIES} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES}) + add_test(rips_persistence_from_alpha_shape_3_2_0 ${CMAKE_CURRENT_BINARY_DIR}/rips_persistence_from_alpha_shape_3 ${CMAKE_SOURCE_DIR}/data/points/bunny_5000.st -p 2 -m 0) + add_test(rips_persistence_from_alpha_shape_3_3_100 ${CMAKE_CURRENT_BINARY_DIR}/rips_persistence_from_alpha_shape_3 ${CMAKE_SOURCE_DIR}/data/points/bunny_5000.st -p 3 -m 100) endif() diff --git a/src/Persistent_cohomology/test/CMakeLists.txt b/src/Persistent_cohomology/test/CMakeLists.txt index 0e5bab1b..c1cbc572 100644 --- a/src/Persistent_cohomology/test/CMakeLists.txt +++ b/src/Persistent_cohomology/test/CMakeLists.txt @@ -23,12 +23,12 @@ if(GMPXX_FOUND AND GMP_FOUND) target_link_libraries(persistent_cohomology_unit_test_multi_field ${Boost_LIBRARIES} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES}) # Unitary tests - add_test(persistent_cohomology_unit_test_multi_field ${CMAKE_CURRENT_BINARY_DIR}/persistent_cohomology_unit_test_multi_field) + #add_test(persistent_cohomology_unit_test_multi_field ${CMAKE_CURRENT_BINARY_DIR}/persistent_cohomology_unit_test_multi_field) endif() if (LCOV_PATH) # Lcov code coverage of unitary test - add_test(persistent_cohomology_unit_test_coverage.info ${CMAKE_SOURCE_DIR}/scripts/check_code_coverage.sh ${CMAKE_SOURCE_DIR}/src/Persistent_cohomology) + add_test(src/Persistent_cohomology/lcov/coverage.log ${CMAKE_SOURCE_DIR}/scripts/check_code_coverage.sh ${CMAKE_SOURCE_DIR}/src/Persistent_cohomology) endif() if (PYTHON_PATH) diff --git a/src/Simplex_tree/example/CMakeLists.txt b/src/Simplex_tree/example/CMakeLists.txt index 6a392d3b..956d1fa9 100644 --- a/src/Simplex_tree/example/CMakeLists.txt +++ b/src/Simplex_tree/example/CMakeLists.txt @@ -7,9 +7,12 @@ message("Boost_lib = ${Boost_LIBRARIES}") add_executable ( simplex_tree_from_file simplex_tree_from_file.cpp ) target_link_libraries(simplex_tree_from_file ${Boost_LIBRARIES}) - +add_test(simplex_tree_from_file_2 ${CMAKE_CURRENT_BINARY_DIR}/simplex_tree_from_file ${CMAKE_SOURCE_DIR}/data/points/Klein_bottle_complex.txt 2) +add_test(simplex_tree_from_file_3 ${CMAKE_CURRENT_BINARY_DIR}/simplex_tree_from_file ${CMAKE_SOURCE_DIR}/data/points/Klein_bottle_complex.txt 3) + add_executable ( simple_simplex_tree simple_simplex_tree.cpp ) target_link_libraries(simple_simplex_tree ${Boost_LIBRARIES}) +add_test(simple_simplex_tree ${CMAKE_CURRENT_BINARY_DIR}/simple_simplex_tree) # An example with Simplex-tree using CGAL alpha_shapes_3 if(GMPXX_FOUND AND GMP_FOUND AND CGAL_FOUND) @@ -19,4 +22,5 @@ if(GMPXX_FOUND AND GMP_FOUND AND CGAL_FOUND) add_executable ( simplex_tree_from_alpha_shapes_3 simplex_tree_from_alpha_shapes_3.cpp ) target_link_libraries(simplex_tree_from_alpha_shapes_3 ${Boost_LIBRARIES} ${GMPXX_LIBRARIES} ${GMP_LIBRARIES} ${CGAL_LIBRARY}) + add_test(simplex_tree_from_alpha_shapes_3 ${CMAKE_CURRENT_BINARY_DIR}/simplex_tree_from_alpha_shapes_3 ${CMAKE_SOURCE_DIR}/data/points/bunny_5000) endif() diff --git a/src/Simplex_tree/example/simple_simplex_tree.cpp b/src/Simplex_tree/example/simple_simplex_tree.cpp index 0ed2039f..11b96a0d 100644 --- a/src/Simplex_tree/example/simple_simplex_tree.cpp +++ b/src/Simplex_tree/example/simple_simplex_tree.cpp @@ -48,12 +48,12 @@ int main (int argc, char * const argv[]) //Construct the Simplex Tree Simplex_tree<> simplexTree; - // Simplex to be inserted: - // 1 - // o - // /X\ - // o---o---o - // 2 0 3 + /* Simplex to be inserted: */ + /* 1 */ + /* o */ + /* /X\ */ + /* o---o---o */ + /* 2 0 3 */ // ++ FIRST std::cout << " * INSERT 0" << std::endl; @@ -299,4 +299,5 @@ int main (int argc, char * const argv[]) // [0.2] 2 1 // [0.2] 3 0 // [0.3] 2 1 0 + return 0; } diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index 9b3de20a..db7ad2b8 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -360,7 +360,7 @@ class Simplex_tree { /** \brief Returns the number of simplices in the complex. * * Does not count the empty simplex. */ - size_t num_simplices() { + const unsigned int& num_simplices() const { return num_simplices_; } @@ -526,7 +526,7 @@ class Simplex_tree { threshold_ = fil; } /** Set a number of simplices for the simplicial complex. */ - void set_num_simplices(size_t num_simplices) { + void set_num_simplices(const unsigned int& num_simplices) { num_simplices_ = num_simplices; } /** Set a dimension for the simplicial complex. */ @@ -793,7 +793,7 @@ class Simplex_tree { /** \brief Upper bound on the filtration values of the simplices.*/ Filtration_value threshold_; /** \brief Total number of simplices in the complex, without the empty simplex.*/ - size_t num_simplices_; + unsigned int num_simplices_; /** \brief Set of simplex tree Nodes representing the vertices.*/ Siblings root_; /** \brief Simplices ordered according to a filtration.*/ diff --git a/src/Simplex_tree/test/CMakeLists.txt b/src/Simplex_tree/test/CMakeLists.txt index d7f968af..e3fcc557 100644 --- a/src/Simplex_tree/test/CMakeLists.txt +++ b/src/Simplex_tree/test/CMakeLists.txt @@ -20,7 +20,7 @@ add_test(simplex_tree_unit_test ${CMAKE_CURRENT_BINARY_DIR}/simplex_tree_unit_te if (LCOV_PATH) # Lcov code coverage of unitary test - add_test(simplex_tree_unit_test_coverage.info ${CMAKE_SOURCE_DIR}/scripts/check_code_coverage.sh ${CMAKE_SOURCE_DIR}/src/Simplex_tree) + add_test(src/Simplex_tree/lcov/coverage.log ${CMAKE_SOURCE_DIR}/scripts/check_code_coverage.sh ${CMAKE_SOURCE_DIR}/src/Simplex_tree) endif() if (PYTHON_PATH) diff --git a/src/Simplex_tree/test/simplex_tree_unit_test.cpp b/src/Simplex_tree/test/simplex_tree_unit_test.cpp index a3671f56..b44f95a8 100644 --- a/src/Simplex_tree/test/simplex_tree_unit_test.cpp +++ b/src/Simplex_tree/test/simplex_tree_unit_test.cpp @@ -166,7 +166,7 @@ void set_and_test_simplex_tree_dim_fil(typeST& simplexTree, int vectorSize, cons simplexTree.set_filtration(max_fil); std::cout << " set_and_test_simplex_tree_dim_fil - max_fil=" << max_fil << std::endl; } - int nb_simplices = simplexTree.num_simplices() + 1; + unsigned int nb_simplices = simplexTree.num_simplices() + 1; simplexTree.set_num_simplices(nb_simplices); BOOST_CHECK( simplexTree.dimension() == dim_max ); @@ -347,11 +347,12 @@ BOOST_AUTO_TEST_CASE( simplex_tree_insertion ) BOOST_CHECK( st.dimension() == dim_max ); BOOST_CHECK( AreAlmostTheSame(st.filtration(), max_fil) ); - // 1 - // o - // /X\ - // o---o---o - // 2 0 3 + /* Inserted simplex: */ + /* 1 */ + /* o */ + /* /X\ */ + /* o---o---o */ + /* 2 0 3 */ // [0.1] 0 // [0.1] 1 |