Commit 5de60218 authored by Jan Möbius's avatar Jan Möbius

Added a combined unittest for iterator and circulator

parent c5aba5f0
Pipeline #5278 passed with stage
in 42 minutes and 36 seconds
......@@ -249,6 +249,72 @@ TEST_F(OpenMesh_Poly, cpp11_vvrange_test) {
EXPECT_EQ(iteration_counter,4);
}
/**
* @brief Test combined vertex iterator and vertex vertex iter.
*/
TEST_F(OpenMesh_Triangle, cpp11_test_enumerate_combined_run) {
//check empty vv_range
mesh_.clear();
Mesh::VertexHandle vhandle[5];
vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 1, 0));
for(Mesh::VertexHandle t : mesh_.vv_range(vhandle[0]))
{
FAIL() << "The vvrange for a single vertex in a TriMesh is not empty";
EXPECT_TRUE(t.is_valid()); // Just so we don't get an unused variable warning.
}
//add more vertices
vhandle[1] = mesh_.add_vertex(Mesh::Point(1, 0, 0));
vhandle[2] = mesh_.add_vertex(Mesh::Point(2, 1, 3));
vhandle[3] = mesh_.add_vertex(Mesh::Point(0,-1, 4));
vhandle[4] = mesh_.add_vertex(Mesh::Point(2,3, 5));
// Add 4 faces
std::vector<Mesh::VertexHandle> face_vhandles;
face_vhandles.push_back(vhandle[0]);
face_vhandles.push_back(vhandle[1]);
face_vhandles.push_back(vhandle[2]);
mesh_.add_face(face_vhandles);
face_vhandles.clear();
face_vhandles.push_back(vhandle[1]);
face_vhandles.push_back(vhandle[3]);
face_vhandles.push_back(vhandle[4]);
mesh_.add_face(face_vhandles);
face_vhandles.clear();
face_vhandles.push_back(vhandle[0]);
face_vhandles.push_back(vhandle[3]);
face_vhandles.push_back(vhandle[1]);
mesh_.add_face(face_vhandles);
face_vhandles.clear();
face_vhandles.push_back(vhandle[2]);
face_vhandles.push_back(vhandle[1]);
face_vhandles.push_back(vhandle[4]);
mesh_.add_face(face_vhandles);
Mesh::Point p = Mesh::Point(0,0,0);
for ( auto vh : mesh_.vertices() ) {
for ( auto vv_it : mesh_.vv_range(vh) ) {
p += mesh_.point(vv_it);
}
}
EXPECT_EQ(p[0],16);
EXPECT_EQ(p[1],12);
EXPECT_EQ(p[2],36);
}
#endif
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment