summaryrefslogtreecommitdiff
path: root/src/Simplex_tree/test
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-09-22 05:37:51 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-09-22 05:37:51 +0000
commit21b1120bfa2047eca025ae759dce2d05f6c86c43 (patch)
tree2f65b7b2f226be5a449db2fb5b400f337b2873a9 /src/Simplex_tree/test
parent346ba542c13db7e49e6d81412144ed21ac46bd83 (diff)
Remove automatic_dimension_set call from remove and prune functions
Make it public to be available Modify tests accordingly git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_automatic_dimension_set@2703 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 2ff42d5327ae76b121390a913c4e548d6f59ea99
Diffstat (limited to 'src/Simplex_tree/test')
-rw-r--r--src/Simplex_tree/test/simplex_tree_remove_unit_test.cpp78
1 files changed, 50 insertions, 28 deletions
diff --git a/src/Simplex_tree/test/simplex_tree_remove_unit_test.cpp b/src/Simplex_tree/test/simplex_tree_remove_unit_test.cpp
index 1e6cea52..87c77801 100644
--- a/src/Simplex_tree/test/simplex_tree_remove_unit_test.cpp
+++ b/src/Simplex_tree/test/simplex_tree_remove_unit_test.cpp
@@ -108,7 +108,12 @@ BOOST_AUTO_TEST_CASE(remove_maximal_simplex) {
st.remove_maximal_simplex(st.find({6, 7}));
std::cout << "st.remove_maximal_simplex({7})" << std::endl;
st.remove_maximal_simplex(st.find({7}));
-
+
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
+ BOOST_CHECK(st.dimension() == 3);
+
+ st.automatic_dimension_set();
+
std::cout << "st.dimension()=" << st.dimension() << " | st_wo_seven.dimension()=" << st_wo_seven.dimension() << std::endl;
BOOST_CHECK(st == st_wo_seven);
}
@@ -130,100 +135,112 @@ BOOST_AUTO_TEST_CASE(auto_dimension_set) {
std::cout << "st.remove_maximal_simplex({6, 7, 8, 10})" << std::endl;
st.remove_maximal_simplex(st.find({6, 7, 8, 10}));
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
BOOST_CHECK(st.dimension() == 3);
std::cout << "st.remove_maximal_simplex({6, 7, 8, 9})" << std::endl;
st.remove_maximal_simplex(st.find({6, 7, 8, 9}));
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
BOOST_CHECK(st.dimension() == 3);
std::cout << "st.remove_maximal_simplex({1, 2, 3, 4})" << std::endl;
st.remove_maximal_simplex(st.find({1, 2, 3, 4}));
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
BOOST_CHECK(st.dimension() == 3);
std::cout << "st.remove_maximal_simplex({1, 2, 3, 5})" << std::endl;
st.remove_maximal_simplex(st.find({1, 2, 3, 5}));
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
+ BOOST_CHECK(st.dimension() == 3);
+ st.automatic_dimension_set();
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
BOOST_CHECK(st.dimension() == 2);
std::cout << "st.insert_simplex_and_subfaces({1, 2, 3, 5})" << std::endl;
st.insert_simplex_and_subfaces({1, 2, 3, 5});
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
BOOST_CHECK(st.dimension() == 3);
std::cout << "st.insert_simplex_and_subfaces({1, 2, 3, 4})" << std::endl;
st.insert_simplex_and_subfaces({1, 2, 3, 4});
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
BOOST_CHECK(st.dimension() == 3);
std::cout << "st.remove_maximal_simplex({1, 2, 3, 5})" << std::endl;
st.remove_maximal_simplex(st.find({1, 2, 3, 5}));
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
BOOST_CHECK(st.dimension() == 3);
std::cout << "st.remove_maximal_simplex({1, 2, 3, 4})" << std::endl;
st.remove_maximal_simplex(st.find({1, 2, 3, 4}));
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
+ BOOST_CHECK(st.dimension() == 3);
+ st.automatic_dimension_set();
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
BOOST_CHECK(st.dimension() == 2);
std::cout << "st.insert_simplex_and_subfaces({0, 1, 3, 4})" << std::endl;
st.insert_simplex_and_subfaces({0, 1, 3, 4});
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
BOOST_CHECK(st.dimension() == 3);
std::cout << "st.remove_maximal_simplex({0, 1, 3, 4})" << std::endl;
st.remove_maximal_simplex(st.find({0, 1, 3, 4}));
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
+ BOOST_CHECK(st.dimension() == 3);
+ st.automatic_dimension_set();
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
BOOST_CHECK(st.dimension() == 2);
std::cout << "st.insert_simplex_and_subfaces({1, 2, 3, 5})" << std::endl;
st.insert_simplex_and_subfaces({1, 2, 3, 5});
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
BOOST_CHECK(st.dimension() == 3);
std::cout << "st.insert_simplex_and_subfaces({1, 2, 3, 4})" << std::endl;
st.insert_simplex_and_subfaces({1, 2, 3, 4});
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
BOOST_CHECK(st.dimension() == 3);
+
// Check you can override the dimension
// This is a limit test case - shall not happen
st.set_dimension(1);
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
BOOST_CHECK(st.dimension() == 1);
-
- // Here no siblings is erased - automatic dimension is not launched.
- std::cout << "st.remove_maximal_simplex({1, 2, 3, 4})" << std::endl;
- st.remove_maximal_simplex(st.find({1, 2, 3, 4}));
+ st.automatic_dimension_set();
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
+ // check automatic_dimension_set() is not giving the rigt answer because dimension is too low
BOOST_CHECK(st.dimension() == 1);
- // Here sibling is erased - automatic dimension is launched.
- std::cout << "st.remove_maximal_simplex({1, 2, 3, 5})" << std::endl;
- st.remove_maximal_simplex(st.find({1, 2, 3, 5}));
- BOOST_CHECK(st.dimension() == 2);
-
- std::cout << "st.insert_simplex_and_subfaces({1, 2, 3, 5})" << std::endl;
- st.insert_simplex_and_subfaces({1, 2, 3, 5});
- BOOST_CHECK(st.dimension() == 3);
-
- std::cout << "st.insert_simplex_and_subfaces({1, 2, 3, 4})" << std::endl;
- st.insert_simplex_and_subfaces({1, 2, 3, 4});
- BOOST_CHECK(st.dimension() == 3);
// Check you can override the dimension
// This is a limit test case - shall not happen
st.set_dimension(6);
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
BOOST_CHECK(st.dimension() == 6);
+ st.automatic_dimension_set();
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
+ // check automatic_dimension_set() resets the correct dimension
+ BOOST_CHECK(st.dimension() == 3);
- // Here no siblings is erased - automatic dimension is not launched.
- std::cout << "st.remove_maximal_simplex({1, 2, 3, 5})" << std::endl;
- st.remove_maximal_simplex(st.find({1, 2, 3, 5}));
- BOOST_CHECK(st.dimension() == 6);
-
- // Here sibling is erased - automatic dimension is launched but dim is always than te one set.
- std::cout << "st.remove_maximal_simplex({1, 2, 3, 4})" << std::endl;
- st.remove_maximal_simplex(st.find({1, 2, 3, 4}));
- BOOST_CHECK(st.dimension() == 6);
// Reset with the correct value
- st.set_dimension(2);
- BOOST_CHECK(st.dimension() == 2);
+ st.set_dimension(3);
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
+ BOOST_CHECK(st.dimension() == 3);
std::cout << "st.insert_simplex_and_subfaces({0, 1, 2, 3, 4, 5, 6})" << std::endl;
st.insert_simplex_and_subfaces({0, 1, 2, 3, 4, 5, 6});
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
BOOST_CHECK(st.dimension() == 6);
std::cout << "st.remove_maximal_simplex({0, 1, 2, 3, 4, 5, 6})" << std::endl;
st.remove_maximal_simplex(st.find({0, 1, 2, 3, 4, 5, 6}));
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
+ BOOST_CHECK(st.dimension() == 6);
+ st.automatic_dimension_set();
+ std::cout << "st.dimension()=" << st.dimension() << std::endl;
BOOST_CHECK(st.dimension() == 5);
}
@@ -325,6 +342,11 @@ BOOST_AUTO_TEST_CASE(prune_above_filtration) {
// Display the Simplex_tree
std::cout << "The complex pruned at 0.0 contains " << st.num_simplices() << " simplices";
std::cout << " - dimension " << st.dimension() << std::endl;
+ BOOST_CHECK(st.dimension() == 3);
+
+ st.automatic_dimension_set();
+ std::cout << "dimension=" << st.dimension() << std::endl;
+ BOOST_CHECK(st.dimension() == -1);
BOOST_CHECK(st == st_empty);
BOOST_CHECK(simplex_is_changed);