summaryrefslogtreecommitdiff
path: root/src/Simplex_tree/test/simplex_tree_unit_test.cpp
diff options
context:
space:
mode:
authorVincent Rouvreau <vincent.rouvreau@inria.fr>2022-05-17 10:33:51 +0200
committerVincent Rouvreau <vincent.rouvreau@inria.fr>2022-05-17 10:33:51 +0200
commit7d1e88a2995e23d882cc3bfe69ec09357d6c2618 (patch)
treeeadb85df0bc3fff3c5101b2e454a6d76bc833736 /src/Simplex_tree/test/simplex_tree_unit_test.cpp
parentff11b137365f0cef11062f9413907f0f39414b3e (diff)
code review: test also the list of all oppposite vertices is the simplex given as an input
Diffstat (limited to 'src/Simplex_tree/test/simplex_tree_unit_test.cpp')
-rw-r--r--src/Simplex_tree/test/simplex_tree_unit_test.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/Simplex_tree/test/simplex_tree_unit_test.cpp b/src/Simplex_tree/test/simplex_tree_unit_test.cpp
index 2b2be89d..b18e2ec4 100644
--- a/src/Simplex_tree/test/simplex_tree_unit_test.cpp
+++ b/src/Simplex_tree/test/simplex_tree_unit_test.cpp
@@ -1015,14 +1015,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_boundaries_and_opposite_vertex_iterat
// simplices must be kept sorted by vertex number for std::vector to use operator== - cf. last BOOST_CHECK
std::vector<Simplex> simplices = {{0, 1, 2}, {0, 3}, {0, 1, 6, 7}, {3, 4, 5}, {3, 5}, {2}};
for (auto simplex : simplices) {
- std::size_t range_size = std::distance(st.boundary_opposite_vertex_simplex_range(st.find(simplex)).begin(),
- st.boundary_opposite_vertex_simplex_range(st.find(simplex)).end());
- std::cout << "Range size = " << range_size << " - " << simplex.size() << std::endl;
- if (simplex.size() > 1) {
- BOOST_CHECK(range_size == simplex.size());
- } else {
- BOOST_CHECK(range_size == 0);
- }
+ Simplex opposite_vertices;
for(auto boundary_and_opposite_vertex : st.boundary_opposite_vertex_simplex_range(st.find(simplex))) {
Simplex output;
for (auto vertex : st.simplex_vertex_range(boundary_and_opposite_vertex.first)) {
@@ -1030,9 +1023,18 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(simplex_tree_boundaries_and_opposite_vertex_iterat
output.emplace_back(vertex);
}
std::clog << " - opposite vertex = " << boundary_and_opposite_vertex.second << std::endl;
+ // Check that boundary simplex + opposite vertex = simplex given as input
output.emplace_back(boundary_and_opposite_vertex.second);
std::sort(output.begin(), output.end());
BOOST_CHECK(simplex == output);
+ opposite_vertices.emplace_back(boundary_and_opposite_vertex.second);
}
+ // Check that the list of all opposite vertices = simplex given as input
+ // no opposite vertices if simplex given as input is of dimension 1
+ std::sort(opposite_vertices.begin(), opposite_vertices.end());
+ if (simplex.size() > 1)
+ BOOST_CHECK(simplex == opposite_vertices);
+ else
+ BOOST_CHECK(opposite_vertices.size() == 0);
}
}