summaryrefslogtreecommitdiff
path: root/src/Simplex_tree/test
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-03-25 11:54:47 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2015-03-25 11:54:47 +0000
commit87032aea5bf14683d964ecd30bd9d744da975e1b (patch)
treee6be67137186aa6d6feb7c26c6872dce1093a919 /src/Simplex_tree/test
parent31dc60d25fa260a14154eca8cab6e15c00d47804 (diff)
Fix of find bug + add example and UT with find.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@504 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: a3b5ed62fe463b1b25f452d7e7e0e0f24f051003
Diffstat (limited to 'src/Simplex_tree/test')
-rw-r--r--src/Simplex_tree/test/simplex_tree_unit_test.cpp61
1 files changed, 61 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 eaec4881..c0cfced1 100644
--- a/src/Simplex_tree/test/simplex_tree_unit_test.cpp
+++ b/src/Simplex_tree/test/simplex_tree_unit_test.cpp
@@ -512,6 +512,67 @@ BOOST_AUTO_TEST_CASE( NSimplexAndSubfaces_tree_insertion )
test_simplex_tree_contains(st,simplexPair4,2); // (1,0) is in position 2
test_simplex_tree_contains(st,simplexPair5,14); // (3,4,5) is in position 14
test_simplex_tree_contains(st,simplexPair6,26); // (7,6,1,0) is in position 26
+
+ // ------------------------------------------------------------------------------------------------------------------
+ // Find in the simplex_tree
+ // ------------------------------------------------------------------------------------------------------------------
+ typeVectorVertex simpleSimplexVector;
+ simpleSimplexVector.push_back(SECOND_VERTEX_HANDLE);
+ Simplex_tree<>::Simplex_handle simplexFound = st.find(simpleSimplexVector);
+ std::cout << "**************IS THE SIMPLEX {1} IN THE SIMPLEX TREE ?\n";
+ if (simplexFound != st.null_simplex())
+ std::cout << "***+ YES IT IS!\n";
+ else
+ std::cout << "***- NO IT ISN'T\n";
+ // Check it is found
+ BOOST_CHECK(simplexFound != st.null_simplex());
+
+ Vertex_handle UNKNOWN_VERTEX_HANDLE = (Vertex_handle) 15;
+ typeVectorVertex unknownSimplexVector;
+ unknownSimplexVector.push_back(UNKNOWN_VERTEX_HANDLE);
+ simplexFound = st.find(unknownSimplexVector);
+ std::cout << "**************IS THE SIMPLEX {15} IN THE SIMPLEX TREE ?\n";
+ if (simplexFound != st.null_simplex())
+ std::cout << "***+ YES IT IS!\n";
+ else
+ std::cout << "***- NO IT ISN'T\n";
+ // Check it is NOT found
+ BOOST_CHECK(simplexFound == st.null_simplex());
+
+ simplexFound = st.find(SimplexVector6);
+ std::cout << "**************IS THE SIMPLEX {0,1,6,7} IN THE SIMPLEX TREE ?\n";
+ if (simplexFound != st.null_simplex())
+ std::cout << "***+ YES IT IS!\n";
+ else
+ std::cout << "***- NO IT ISN'T\n";
+ // Check it is found
+ BOOST_CHECK(simplexFound != st.null_simplex());
+
+ typeVectorVertex otherSimplexVector;
+ otherSimplexVector.push_back(UNKNOWN_VERTEX_HANDLE);
+ otherSimplexVector.push_back(SECOND_VERTEX_HANDLE);
+ simplexFound = st.find(otherSimplexVector);
+ std::cout << "**************IS THE SIMPLEX {15,1} IN THE SIMPLEX TREE ?\n";
+ if (simplexFound != st.null_simplex())
+ std::cout << "***+ YES IT IS!\n";
+ else
+ std::cout << "***- NO IT ISN'T\n";
+ // Check it is NOT found
+ BOOST_CHECK(simplexFound == st.null_simplex());
+
+ typeVectorVertex invSimplexVector;
+ invSimplexVector.push_back(SECOND_VERTEX_HANDLE);
+ invSimplexVector.push_back(THIRD_VERTEX_HANDLE);
+ invSimplexVector.push_back(FIRST_VERTEX_HANDLE);
+ simplexFound = st.find(invSimplexVector);
+ std::cout << "**************IS THE SIMPLEX {1,2,0} IN THE SIMPLEX TREE ?\n";
+ if (simplexFound != st.null_simplex())
+ std::cout << "***+ YES IT IS!\n";
+ else
+ std::cout << "***- NO IT ISN'T\n";
+ // Check it is found
+ BOOST_CHECK(simplexFound != st.null_simplex());
+
// Display the Simplex_tree - Can not be done in the middle of 2 inserts
std::cout << "The complex contains " << st.num_simplices() << " simplices" << std::endl;
std::cout << " - dimension " << st.dimension() << " - filtration " << st.filtration() << std::endl;