fix unused variables in unittests

This commit is contained in:
Max Lyon
2019-12-09 11:15:26 +01:00
parent ee752ce996
commit 7926bc92e5
4 changed files with 29 additions and 20 deletions

View File

@@ -469,9 +469,9 @@ TEST_F(OpenMeshSmartHandles, MixOldAndNew)
for (OpenMesh::SmartHalfedgeHandle heh : mesh_.halfedges()) for (OpenMesh::SmartHalfedgeHandle heh : mesh_.halfedges())
{ {
heh = mesh_.opposite_halfedge_handle(heh); heh = mesh_.opposite_halfedge_handle(heh);
OpenMesh::SmartEdgeHandle eh = OpenMesh::PolyConnectivity::s_edge_handle(heh); EXPECT_TRUE((std::is_same<OpenMesh::SmartEdgeHandle, decltype(OpenMesh::PolyConnectivity::s_edge_handle(heh))>::value));
OpenMesh::SmartEdgeHandle eh2 = mesh_.edge_handle(heh); EXPECT_TRUE((std::is_same<OpenMesh::SmartEdgeHandle, decltype(mesh_.edge_handle(heh))>::value));
OpenMesh::SmartFaceHandle fh = mesh_.face_handle(heh); EXPECT_TRUE((std::is_same<OpenMesh::SmartFaceHandle, decltype(mesh_.face_handle(heh))>::value));
} }
} }
@@ -552,10 +552,11 @@ TEST(OpenMeshSmartHandlesNoFixture, SplitTriMesh)
auto p = (MyMesh::Point()); auto p = (MyMesh::Point());
OpenMesh::SmartVertexHandle vh = mesh.split(fh, p); OpenMesh::SmartVertexHandle vh = mesh.split(fh, p);
OpenMesh::SmartEdgeHandle eh = fh.halfedge().edge(); OpenMesh::SmartEdgeHandle eh = fh.halfedge().edge();
OpenMesh::SmartVertexHandle vh2 = mesh.split(eh, p); OpenMesh::SmartVertexHandle vh2 = mesh.split(eh, p);
EXPECT_NE(vh.idx(), vh2.idx()) << "This was only intended to fix an unused variable warning but cool that it caugth an actual error now";
} }

View File

@@ -225,12 +225,12 @@ TEST_F(OpenMeshSmartRanges, ToVector)
auto tri_uvs = fh.halfedges().to_vector(uvs); auto tri_uvs = fh.halfedges().to_vector(uvs);
auto heh_handles = fh.halfedges().to_vector(); auto heh_handles = fh.halfedges().to_vector();
for (auto heh : heh_handles) for (auto heh : heh_handles)
auto n = heh.next(); heh.next();
} }
auto vertex_vec = mesh_.vertices().to_vector(); auto vertex_vec = mesh_.vertices().to_vector();
for (auto vh : vertex_vec) for (auto vh : vertex_vec)
auto heh = vh.out(); vh.out();
} }
/* Test to array /* Test to array
@@ -244,8 +244,8 @@ TEST_F(OpenMeshSmartRanges, ToArray)
for (auto fh : mesh_.faces()) for (auto fh : mesh_.faces())
{ {
auto tri_uvs = fh.halfedges().to_array<3>(uvs); fh.halfedges().to_array<3>(uvs);
auto heh_handles = fh.halfedges().to_array<3>(); fh.halfedges().to_array<3>();
} }
} }
@@ -263,7 +263,7 @@ TEST_F(OpenMeshSmartRanges, BoundingBox)
auto bb_min = mesh_.vertices().min(myPos); auto bb_min = mesh_.vertices().min(myPos);
auto bb_max = mesh_.vertices().max(myPos); auto bb_max = mesh_.vertices().max(myPos);
auto bb = mesh_.vertices().minmax(myPos); mesh_.vertices().minmax(myPos);
EXPECT_LT(norm(bb_min - OpenMesh::Vec3f(-1,-1,-1)), 0.000001) << "Bounding box minimum seems off"; EXPECT_LT(norm(bb_min - OpenMesh::Vec3f(-1,-1,-1)), 0.000001) << "Bounding box minimum seems off";
EXPECT_LT(norm(bb_max - OpenMesh::Vec3f( 1, 1, 1)), 0.000001) << "Bounding box maximum seems off"; EXPECT_LT(norm(bb_max - OpenMesh::Vec3f( 1, 1, 1)), 0.000001) << "Bounding box maximum seems off";
@@ -275,8 +275,8 @@ TEST_F(OpenMeshSmartRanges, BoundingBox)
for (auto fh : mesh_.faces()) for (auto fh : mesh_.faces())
{ {
auto uv_bb_min = fh.halfedges().min(uvs); fh.halfedges().min(uvs);
auto uv_bb_max = fh.halfedges().max(uvs); fh.halfedges().max(uvs);
} }
} }

View File

@@ -127,7 +127,7 @@ TEST_F(OpenMeshSplitEdgeCopyPolyMesh, SplitEdgeCopyPolymesh) {
face_vhandles.push_back(vhandle[2]); face_vhandles.push_back(vhandle[2]);
face_vhandles.push_back(vhandle[3]); face_vhandles.push_back(vhandle[3]);
PolyMesh::FaceHandle fh = mesh_.add_face(face_vhandles); mesh_.add_face(face_vhandles);
PolyMesh::EdgeHandle eh = *mesh_.edges_begin(); PolyMesh::EdgeHandle eh = *mesh_.edges_begin();
// Test setup: // Test setup:

View File

@@ -904,12 +904,14 @@ TEST_F(OpenMeshIterators, RangeIterators) {
int count_faces_range = 0; int count_faces_range = 0;
for (auto fh : mesh_.faces()) for (auto fh : mesh_.faces())
++count_faces_range; if (fh.is_valid()) // not actually necessary but fixes unused variable warning
++count_faces_range;
EXPECT_EQ(1, count_faces_range) << "Wrong number of visited faces."; EXPECT_EQ(1, count_faces_range) << "Wrong number of visited faces.";
int count_faces_range_all = 0; int count_faces_range_all = 0;
for (auto fh : mesh_.all_faces()) for (auto fh : mesh_.all_faces())
++count_faces_range_all; if (fh.is_valid()) // not actually necessary but fixes unused variable warning
++count_faces_range_all;
EXPECT_EQ(2, count_faces_range_all) << "Wrong number of visited faces."; EXPECT_EQ(2, count_faces_range_all) << "Wrong number of visited faces.";
@@ -927,12 +929,14 @@ TEST_F(OpenMeshIterators, RangeIterators) {
int count_edges_range = 0; int count_edges_range = 0;
for (auto eh : mesh_.edges()) for (auto eh : mesh_.edges())
++count_edges_range; if (eh.is_valid()) // not actually necessary but fixes unused variable warning
++count_edges_range;
EXPECT_EQ(3, count_edges_range) << "Wrong number of visited edges."; EXPECT_EQ(3, count_edges_range) << "Wrong number of visited edges.";
int count_edges_range_all = 0; int count_edges_range_all = 0;
for (auto eh : mesh_.all_edges()) for (auto eh : mesh_.all_edges())
++count_edges_range_all; if (eh.is_valid()) // not actually necessary but fixes unused variable warning
++count_edges_range_all;
EXPECT_EQ(5, count_edges_range_all) << "Wrong number of visited edges."; EXPECT_EQ(5, count_edges_range_all) << "Wrong number of visited edges.";
@@ -950,12 +954,14 @@ TEST_F(OpenMeshIterators, RangeIterators) {
int count_halfedges_range = 0; int count_halfedges_range = 0;
for (auto heh : mesh_.halfedges()) for (auto heh : mesh_.halfedges())
++count_halfedges_range; if (heh.is_valid()) // not actually necessary but fixes unused variable warning
++count_halfedges_range;
EXPECT_EQ(6, count_halfedges_range) << "Wrong number of visited halfedges."; EXPECT_EQ(6, count_halfedges_range) << "Wrong number of visited halfedges.";
int count_halfedges_range_all = 0; int count_halfedges_range_all = 0;
for (auto heh : mesh_.all_halfedges()) for (auto heh : mesh_.all_halfedges())
++count_halfedges_range_all; if (heh.is_valid()) // not actually necessary but fixes unused variable warning
++count_halfedges_range_all;
EXPECT_EQ(10, count_halfedges_range_all) << "Wrong number of visited halfedges."; EXPECT_EQ(10, count_halfedges_range_all) << "Wrong number of visited halfedges.";
@@ -973,12 +979,14 @@ TEST_F(OpenMeshIterators, RangeIterators) {
int count_vertices_range = 0; int count_vertices_range = 0;
for (auto vh : mesh_.vertices()) for (auto vh : mesh_.vertices())
++count_vertices_range; if (vh.is_valid()) // not actually necessary but fixes unused variable warning
++count_vertices_range;
EXPECT_EQ(3, count_vertices_range) << "Wrong number of visited vertices."; EXPECT_EQ(3, count_vertices_range) << "Wrong number of visited vertices.";
int count_vertices_range_all = 0; int count_vertices_range_all = 0;
for (auto vh : mesh_.all_vertices()) for (auto vh : mesh_.all_vertices())
++count_vertices_range_all; if (vh.is_valid()) // not actually necessary but fixes unused variable warning
++count_vertices_range_all;
EXPECT_EQ(4, count_vertices_range_all) << "Wrong number of visited vertices."; EXPECT_EQ(4, count_vertices_range_all) << "Wrong number of visited vertices.";