From 84c6c8c7ec62f25599b0cbdce709ee97fcfa4720 Mon Sep 17 00:00:00 2001
From: Dmitri Naumov <github@naumov.de>
Date: Mon, 13 Jul 2020 17:43:22 +0200
Subject: [PATCH] [T/GL] Generate non-empty surfaces with >= 1 tri.

---
 Tests/GeoLib/TestDuplicateGeometry.cpp | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/Tests/GeoLib/TestDuplicateGeometry.cpp b/Tests/GeoLib/TestDuplicateGeometry.cpp
index 22188b8cf27..af1f4e71bd5 100644
--- a/Tests/GeoLib/TestDuplicateGeometry.cpp
+++ b/Tests/GeoLib/TestDuplicateGeometry.cpp
@@ -117,7 +117,7 @@ TEST(GeoLib, DuplicateGeometry)
         auto sfcs = std::make_unique<std::vector<GeoLib::Surface*>>();
         for (int i = 0; i < n_sfcs; ++i)
         {
-            int const n_tris = std::rand() % 10;
+            int const n_tris = std::rand() % 10 + 1;
             auto* sfc = new GeoLib::Surface(*geo.getPointVec(input_name));
             for (int j = 0; j < n_tris; ++j)
             {
@@ -125,14 +125,8 @@ TEST(GeoLib, DuplicateGeometry)
                                  std::rand() % n_pnts,
                                  std::rand() % n_pnts);
             }
-            if (sfc->getNumberOfTriangles() > 0)
-            {
-                sfcs->push_back(sfc);
-            }
-            else
-            {
-                delete sfc;
-            }
+            ASSERT_GT(sfc->getNumberOfTriangles(), 0);
+            sfcs->push_back(sfc);
         }
         geo.addSurfaceVec(std::move(sfcs), input_name);
     }
-- 
GitLab