From 77243b4c6ad09f1f60122191414fc5fb2e2cc865 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Mon, 14 Mar 2016 15:08:30 +0000 Subject: Remove Options::store_filtration check is true in prune_above_filtration function in order to let the user empty the tree To empty the tree, call initialize_filtration() and prune_above_filtration(-1) Add a UT to test this case git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/alphashapes@1044 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: bb4a916fb547c6312f2138d355903ef87525e9c4 --- src/Simplex_tree/test/simplex_tree_unit_test.cpp | 40 ++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) (limited to 'src/Simplex_tree/test') diff --git a/src/Simplex_tree/test/simplex_tree_unit_test.cpp b/src/Simplex_tree/test/simplex_tree_unit_test.cpp index ff8993b3..b8c1cc35 100644 --- a/src/Simplex_tree/test/simplex_tree_unit_test.cpp +++ b/src/Simplex_tree/test/simplex_tree_unit_test.cpp @@ -985,7 +985,6 @@ BOOST_AUTO_TEST_CASE(prune_above_filtration) { st.insert_simplex_and_subfaces({0, 1, 6, 7}, 1.0); st.insert_simplex_and_subfaces({3, 4, 5}, 2.0); - st.set_filtration(6.0); // Constructs a copy at this state for further test purpose typeST st_pruned = st; @@ -1053,7 +1052,6 @@ BOOST_AUTO_TEST_CASE(prune_above_filtration) { BOOST_CHECK(st == st_pruned); typeST st_empty; - st_empty.set_filtration(6.0); // For equality reason // FIXME st_empty.set_dimension(3); st.prune_above_filtration(0.0); @@ -1068,3 +1066,41 @@ BOOST_AUTO_TEST_CASE(prune_above_filtration) { st.prune_above_filtration(-1.0); BOOST_CHECK(st == st_empty); } + +BOOST_AUTO_TEST_CASE(mini_prune_above_filtration) { + std::cout << "********************************************************************" << std::endl; + std::cout << "MINI PRUNE ABOVE FILTRATION" << std::endl; + typedef Simplex_tree typeST; + typeST st; + + // FIXME + st.set_dimension(3); + + st.insert_simplex_and_subfaces({0, 1, 6, 7}); + st.insert_simplex_and_subfaces({3, 4, 5}); + st.insert_simplex_and_subfaces({3, 0}); + st.insert_simplex_and_subfaces({2, 1, 0}); + + // st: + // 1 6 + // o---o + // /X\7/ + // o---o---o---o + // 2 0 3\X/4 + // o + // 5 + + st.initialize_filtration(); + + // Display the Simplex_tree + std::cout << "The complex contains " << st.num_simplices() << " simplices" << std::endl; + BOOST_CHECK(st.num_simplices() == 27); + + // Test case to the limit + st.prune_above_filtration(-1.0); + + // Display the Simplex_tree + std::cout << "The complex contains " << st.num_simplices() << " simplices" << std::endl; + BOOST_CHECK(st.num_simplices() == 0); + +} \ No newline at end of file -- cgit v1.2.3