|
1 |
| - |
2 | 1 | #include "geometrycentral/surface/manifold_surface_mesh.h"
|
3 | 2 | #include "geometrycentral/surface/meshio.h"
|
4 | 3 | #include "geometrycentral/surface/rich_surface_mesh_data.h"
|
@@ -237,6 +236,66 @@ TEST_F(HalfedgeMeshSuite, IterateBoundaryLoopsTest) {
|
237 | 236 | }
|
238 | 237 |
|
239 | 238 |
|
| 239 | +// ============================================================ |
| 240 | +// =============== Counts and internals |
| 241 | +// ============================================================ |
| 242 | + |
| 243 | +TEST_F(HalfedgeMeshSuite, IndexCountTest) { |
| 244 | + for (MeshAsset& a : allMeshes()) { |
| 245 | + a.printThyName(); |
| 246 | + |
| 247 | + { // Vertices |
| 248 | + bool maxSeen = false; |
| 249 | + for (Vertex v : a.mesh->vertices()) { |
| 250 | + EXPECT_LT(v.getIndex(), a.mesh->vertexIndexSize()); |
| 251 | + if ((v.getIndex() + 1) == a.mesh->vertexIndexSize()) maxSeen = true; |
| 252 | + } |
| 253 | + EXPECT_TRUE(maxSeen); |
| 254 | + } |
| 255 | + |
| 256 | + { // Halfedges |
| 257 | + bool maxSeen = false; |
| 258 | + for (Halfedge he : a.mesh->halfedges()) { |
| 259 | + EXPECT_LT(he.getIndex(), a.mesh->halfedgeIndexSize()); |
| 260 | + if ((he.getIndex() + 1) == a.mesh->halfedgeIndexSize()) maxSeen = true; |
| 261 | + } |
| 262 | + EXPECT_TRUE(maxSeen); |
| 263 | + } |
| 264 | + |
| 265 | + { // Corners |
| 266 | + bool maxSeen = false; |
| 267 | + for (Corner c : a.mesh->corners()) { |
| 268 | + EXPECT_LT(c.getIndex(), a.mesh->cornerIndexSize()); |
| 269 | + |
| 270 | + // special case for corners, they have a weaker guarantee and |
| 271 | + // cornerIndexSize() may be not-tight by 1 |
| 272 | + if ((c.getIndex() + 1) == a.mesh->cornerIndexSize()) maxSeen = true; |
| 273 | + if ((c.getIndex() + 2) == a.mesh->cornerIndexSize()) maxSeen = true; |
| 274 | + } |
| 275 | + EXPECT_TRUE(maxSeen); |
| 276 | + } |
| 277 | + |
| 278 | + { // Edges |
| 279 | + bool maxSeen = false; |
| 280 | + for (Edge e : a.mesh->edges()) { |
| 281 | + EXPECT_LT(e.getIndex(), a.mesh->edgeIndexSize()); |
| 282 | + if ((e.getIndex() + 1) == a.mesh->edgeIndexSize()) maxSeen = true; |
| 283 | + } |
| 284 | + EXPECT_TRUE(maxSeen); |
| 285 | + } |
| 286 | + |
| 287 | + { // Faces |
| 288 | + bool maxSeen = false; |
| 289 | + for (Face f : a.mesh->faces()) { |
| 290 | + EXPECT_LT(f.getIndex(), a.mesh->faceIndexSize()); |
| 291 | + if ((f.getIndex() + 1) == a.mesh->faceIndexSize()) maxSeen = true; |
| 292 | + } |
| 293 | + EXPECT_TRUE(maxSeen); |
| 294 | + } |
| 295 | + } |
| 296 | +} |
| 297 | + |
| 298 | + |
240 | 299 | // ============================================================
|
241 | 300 | // =============== Utility and status functions
|
242 | 301 | // ============================================================
|
@@ -764,7 +823,6 @@ TEST_F(HalfedgeMeshSuite, EdgeDiamondNavigator) {
|
764 | 823 | }
|
765 | 824 | }
|
766 | 825 |
|
767 |
| - |
768 | 826 | // ============================================================
|
769 | 827 | // =============== Utilities
|
770 | 828 | // ============================================================
|
|
0 commit comments