summaryrefslogtreecommitdiff
path: root/src/Simplex_tree/test/simplex_tree_unit_test.cpp
diff options
context:
space:
mode:
authorglisse <glisse@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-11-09 20:02:44 +0000
committerglisse <glisse@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-11-09 20:02:44 +0000
commiteecc6eef3ca893894c885eed6e7fb5861cea074b (patch)
tree34ae7a98d5c4f64cdba54ebe8e878ae01f594b89 /src/Simplex_tree/test/simplex_tree_unit_test.cpp
parent50351a117c7f2622ce2eb5d1d08f561cb9baaa89 (diff)
Specific test for non-contiguous vertices.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/contiguous_vertices@898 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 5295613117e6a66147dec38327b437bcf5b253c3
Diffstat (limited to 'src/Simplex_tree/test/simplex_tree_unit_test.cpp')
-rw-r--r--src/Simplex_tree/test/simplex_tree_unit_test.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/Simplex_tree/test/simplex_tree_unit_test.cpp b/src/Simplex_tree/test/simplex_tree_unit_test.cpp
index beb3dc11..874c3363 100644
--- a/src/Simplex_tree/test/simplex_tree_unit_test.cpp
+++ b/src/Simplex_tree/test/simplex_tree_unit_test.cpp
@@ -759,3 +759,39 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(copy_move_on_simplex_tree, typeST, list_of_tested_
std::cout << "Printing st once again- address = " << &st << std::endl;
}
+
+template<class typeST>
+void test_simplex_is_vertex(typeST& st, typename typeST::Simplex_handle sh, typename typeST::Vertex_handle v) {
+ BOOST_CHECK(st.dimension(sh) == 0);
+ auto&& r = st.simplex_vertex_range(sh);
+ auto i = std::begin(r);
+ BOOST_CHECK(*i == v);
+ BOOST_CHECK(++i == std::end(r));
+}
+
+BOOST_AUTO_TEST_CASE(non_contiguous) {
+ typedef Simplex_tree<> typeST;
+ typedef typeST::Vertex_handle Vertex_handle;
+ typedef typeST::Simplex_handle Simplex_handle;
+ std::cout << "********************************************************************" << std::endl;
+ std::cout << "TEST NON-CONTIGUOUS VERTICES" << std::endl;
+ typeST st;
+ Vertex_handle e[] = {3,-7};
+ std::cout << "Insert" << std::endl;
+ st.insert_simplex_and_subfaces(e);
+ BOOST_CHECK(st.num_vertices() == 2);
+ BOOST_CHECK(st.num_simplices() == 3);
+ std::cout << "Find" << std::endl;
+ Simplex_handle sh = st.find(e);
+ BOOST_CHECK(sh != st.null_simplex());
+ std::cout << "Endpoints" << std::endl;
+ auto p = st.endpoints(sh);
+ test_simplex_is_vertex(st, p.first, 3);
+ test_simplex_is_vertex(st, p.second, -7);
+ std::cout << "Boundary" << std::endl;
+ auto&& b = st.boundary_simplex_range(sh);
+ auto i = std::begin(b);
+ test_simplex_is_vertex(st, *i, -7);
+ test_simplex_is_vertex(st, *++i, 3);
+ BOOST_CHECK(++i == std::end(b));
+}