From b119d1c990f3ba8df9f5157bddf9ab00d5591cde Mon Sep 17 00:00:00 2001
From: Incardona Pietro <incardon@mpi-cbg.de>
Date: Fri, 28 May 2021 22:27:34 +0200
Subject: [PATCH] Fixing test for getPos on grid

---
 src/Grid/tests/grid_dist_id_unit_test.cpp | 28 ++++++++++++++---------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/src/Grid/tests/grid_dist_id_unit_test.cpp b/src/Grid/tests/grid_dist_id_unit_test.cpp
index 1be88e3f7..a13d79a34 100644
--- a/src/Grid/tests/grid_dist_id_unit_test.cpp
+++ b/src/Grid/tests/grid_dist_id_unit_test.cpp
@@ -99,19 +99,22 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_domain_grid_unit_converter3D_test)
 
 		auto it = g_dist.getDomainIterator();
 
-		auto key = it.get();
-		auto gkey = it.getGKey(key);
+		if (it.isNext())
+		{
+			auto key = it.get();
+			auto gkey = it.getGKey(key);
 
-		auto pos = g_dist.getPos(key);
+			auto pos = g_dist.getPos(key);
 
-		if (gkey.get(0) == 0 && gkey.get(1) == 0 && gkey.get(2) == 0)
-		{
-			BOOST_REQUIRE_CLOSE(pos.get(0),-0.3f,0.0001);
-			BOOST_REQUIRE_CLOSE(pos.get(1),-0.3f,0.0001);
-			BOOST_REQUIRE_CLOSE(pos.get(2),-0.3f,0.0001);
+			if (gkey.get(0) == 0 && gkey.get(1) == 0 && gkey.get(2) == 0)
+			{
+				BOOST_REQUIRE_CLOSE(pos.get(0),-0.3f,0.0001);
+				BOOST_REQUIRE_CLOSE(pos.get(1),-0.3f,0.0001);
+				BOOST_REQUIRE_CLOSE(pos.get(2),-0.3f,0.0001);
+			}
 		}
 
-		bool check = false;
+		int check = 0;
 
 		while (it.isNext())
 		{
@@ -123,13 +126,16 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_domain_grid_unit_converter3D_test)
 				pos[1] >= 0.99999 && pos[1] <= 1.00001 &&
 				pos[2] >= 0.99999 && pos[2] <= 1.00001)
 			{
-				check = true;
+				check = 1;
 			}
 
 			++it;
 		}
 
-		BOOST_REQUIRE_EQUAL(check,true);
+		v_cl.max(check);
+		v_cl.execute();
+
+		BOOST_REQUIRE_EQUAL(check,1);
 	}
 }
 
-- 
GitLab