Commit 7d2f6608 authored by Jan Möbius's avatar Jan Möbius

Uinittest for face halfedge circulator

Uinittest for face edge circulator



git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@794 fdac6126-5c0c-442c-9429-916003d36597
parent 82f9839a
......@@ -31,3 +31,99 @@ class OpenMeshTrimeshCirculatorFaceEdge : public OpenMeshBase {
*/
/*
* Small FaceEdgeIterator Test
*/
TEST_F(OpenMeshTrimeshCirculatorFaceEdge, FaceEdgeIterWithoutHolesIncrement) {
mesh_.clear();
// Add some vertices
Mesh::VertexHandle vhandle[6];
vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 1, 0));
vhandle[1] = mesh_.add_vertex(Mesh::Point(1, 0, 0));
vhandle[2] = mesh_.add_vertex(Mesh::Point(2, 1, 0));
vhandle[3] = mesh_.add_vertex(Mesh::Point(3, 0, 0));
vhandle[4] = mesh_.add_vertex(Mesh::Point(4, 1, 0));
vhandle[5] = mesh_.add_vertex(Mesh::Point(2,-1, 0));
// Add three 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[2]);
face_vhandles.push_back(vhandle[1]);
face_vhandles.push_back(vhandle[3]);
mesh_.add_face(face_vhandles);
face_vhandles.clear();
face_vhandles.push_back(vhandle[2]);
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[1]);
face_vhandles.push_back(vhandle[5]);
face_vhandles.push_back(vhandle[3]);
mesh_.add_face(face_vhandles);
/* Test setup:
*
* 0 ------ 2 ------ 4
* \ / \ /
* \ 0 / \ 2 /
* \ / 1 \ /
* 1 ------- 3
* \ /
* \ 3 /
* \ /
* \ /
* 5
*/
Mesh::FaceEdgeIter fe_it = mesh_.fe_begin(mesh_.face_handle(1));
Mesh::FaceEdgeIter fe_end = mesh_.fe_end(mesh_.face_handle(1));
EXPECT_EQ(4, fe_it.handle().idx() ) << "Index wrong in FaceEdgeIter at initialization";
EXPECT_TRUE(fe_it) << "Iterator invalid in FaceEdgeIter at initialization";
++fe_it;
EXPECT_EQ(1, fe_it.handle().idx() ) << "Index wrong in FaceEdgeIter at step 1";
EXPECT_TRUE(fe_it) << "Iterator invalid in FaceEdgeIter at step 1";
++fe_it;
EXPECT_EQ(3, fe_it.handle().idx() ) << "Index wrong in FaceEdgeIter at step 2";
EXPECT_TRUE(fe_it) << "Iterator invalid in FaceEdgeIter at step 2";
++fe_it;
EXPECT_EQ(4, fe_it.handle().idx() ) << "Index wrong in FaceEdgeIter at end";
EXPECT_FALSE(fe_it) << "Iterator invalid in FaceEdgeIter at end";
EXPECT_TRUE( fe_it == fe_end ) << "End iterator for FaceEdgeIter not matching";
Mesh::ConstFaceEdgeIter cfe_it = mesh_.cfe_begin(mesh_.face_handle(1));
Mesh::ConstFaceEdgeIter cfe_end = mesh_.cfe_end(mesh_.face_handle(1));
EXPECT_EQ(4, cfe_it.handle().idx() ) << "Index wrong in ConstFaceEdgeIter at initialization";
EXPECT_TRUE(cfe_it) << "Iterator invalid in ConstFaceEdgeIter at initialization";
++cfe_it;
EXPECT_EQ(1, cfe_it.handle().idx() ) << "Index wrong in ConstFaceEdgeIter at step 1";
EXPECT_TRUE(cfe_it) << "Iterator invalid in ConstFaceEdgeIter at step 1";
++cfe_it;
EXPECT_EQ(3, cfe_it.handle().idx() ) << "Index wrong in ConstFaceEdgeIter at step 2";
EXPECT_TRUE(cfe_it) << "Iterator invalid in ConstFaceEdgeIter at step 2";
++cfe_it;
EXPECT_EQ(4, cfe_it.handle().idx() ) << "Index wrong in ConstFaceEdgeIter at end";
EXPECT_FALSE(cfe_it) << "Iterator invalid in ConstFaceEdgeIter at end";
EXPECT_TRUE( cfe_it == cfe_end ) << "End iterator for ConstFaceEdgeIter not matching";
}
......@@ -30,3 +30,100 @@ class OpenMeshTrimeshCirculatorFaceHalfEdge : public OpenMeshBase {
* ====================================================================
*/
/*
* Small FaceHalfedgeIterator Test
*/
TEST_F(OpenMeshTrimeshCirculatorFaceHalfEdge, FaceHalfedgeIterWithoutHolesIncrement) {
mesh_.clear();
// Add some vertices
Mesh::VertexHandle vhandle[6];
vhandle[0] = mesh_.add_vertex(Mesh::Point(0, 1, 0));
vhandle[1] = mesh_.add_vertex(Mesh::Point(1, 0, 0));
vhandle[2] = mesh_.add_vertex(Mesh::Point(2, 1, 0));
vhandle[3] = mesh_.add_vertex(Mesh::Point(3, 0, 0));
vhandle[4] = mesh_.add_vertex(Mesh::Point(4, 1, 0));
vhandle[5] = mesh_.add_vertex(Mesh::Point(2,-1, 0));
// Add three 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[2]);
face_vhandles.push_back(vhandle[1]);
face_vhandles.push_back(vhandle[3]);
mesh_.add_face(face_vhandles);
face_vhandles.clear();
face_vhandles.push_back(vhandle[2]);
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[1]);
face_vhandles.push_back(vhandle[5]);
face_vhandles.push_back(vhandle[3]);
mesh_.add_face(face_vhandles);
/* Test setup:
*
* 0 ------ 2 ------ 4
* \ / \ /
* \ 0 / \ 2 /
* \ / 1 \ /
* 1 ------- 3
* \ /
* \ 3 /
* \ /
* \ /
* 5
*/
Mesh::FaceHalfedgeIter fh_it = mesh_.fh_begin(mesh_.face_handle(1));
Mesh::FaceHalfedgeIter fh_end = mesh_.fh_end(mesh_.face_handle(1));
EXPECT_EQ(8, fh_it.handle().idx() ) << "Index wrong in FaceHalfedgeIter at initialization";
EXPECT_TRUE(fh_it) << "Iterator invalid in FaceHalfedgeIter at initialization";
++fh_it;
EXPECT_EQ(3, fh_it.handle().idx() ) << "Index wrong in FaceHalfedgeIter at step 1";
EXPECT_TRUE(fh_it) << "Iterator invalid in FaceHalfedgeIter at step 1";
++fh_it;
EXPECT_EQ(6, fh_it.handle().idx() ) << "Index wrong in FaceHalfedgeIter at step 2";
EXPECT_TRUE(fh_it) << "Iterator invalid in FaceHalfedgeIter at step 2";
++fh_it;
EXPECT_EQ(8, fh_it.handle().idx() ) << "Index wrong in FaceHalfedgeIter at end";
EXPECT_FALSE(fh_it) << "Iterator invalid in FaceHalfedgeIter at end";
EXPECT_TRUE( fh_it == fh_end ) << "End iterator for FaceHalfedgeIter not matching";
Mesh::ConstFaceHalfedgeIter cfh_it = mesh_.cfh_begin(mesh_.face_handle(1));
Mesh::ConstFaceHalfedgeIter cfh_end = mesh_.cfh_end(mesh_.face_handle(1));
EXPECT_EQ(8, cfh_it.handle().idx() ) << "Index wrong in ConstFaceHalfedgeIter at initialization";
EXPECT_TRUE(cfh_it) << "Iterator invalid in ConstFaceHalfedgeIter at initialization";
++cfh_it;
EXPECT_EQ(3, cfh_it.handle().idx() ) << "Index wrong in ConstFaceHalfedgeIter at step 1";
EXPECT_TRUE(cfh_it) << "Iterator invalid in ConstFaceHalfedgeIter at step 1";
++cfh_it;
EXPECT_EQ(6, cfh_it.handle().idx() ) << "Index wrong in ConstFaceHalfedgeIter at step 2";
EXPECT_TRUE(cfh_it) << "Iterator invalid in ConstFaceHalfedgeIter at step 2";
++cfh_it;
EXPECT_EQ(8, cfh_it.handle().idx() ) << "Index wrong in ConstFaceHalfedgeIter at end";
EXPECT_FALSE(cfh_it) << "Iterator invalid in ConstFaceHalfedgeIter at end";
EXPECT_TRUE( cfh_it == cfh_end ) << "End iterator for ConstFaceHalfedgeIter not matching";
}
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