From 540dfe51335dc3464976cda7db73e85050e97c93 Mon Sep 17 00:00:00 2001
From: Pietro Incardona <incardon@mpi-cbg.de>
Date: Thu, 15 Feb 2018 19:50:59 +0100
Subject: [PATCH] Fixing tests

---
 ...grid_dist_id_HDF5_chckpnt_restart_test.hpp | 20 ++++++-------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/src/Grid/grid_dist_id_HDF5_chckpnt_restart_test.hpp b/src/Grid/grid_dist_id_HDF5_chckpnt_restart_test.hpp
index 465b1b301..75a1878ea 100644
--- a/src/Grid/grid_dist_id_HDF5_chckpnt_restart_test.hpp
+++ b/src/Grid/grid_dist_id_HDF5_chckpnt_restart_test.hpp
@@ -71,12 +71,12 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_hdf5_save_test )
 	size_t sum = 0;
 
 	for (size_t i = 0; i < count_total.size(); i++)
-		sum += count_total.get(i);
+	{sum += count_total.get(i);}
 
 	timer t;
 	t.start();
 	// Save the grid
-    g_dist.save("grid_dist_id.h5");
+    g_dist.save("grid_dist_id.h5" + std::to_string(v_cl.getProcessingUnits()));
 	t.stop();
 }
 
@@ -108,22 +108,13 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_hdf5_load_test )
 	// Distributed grid with id decomposition
 	grid_dist_id<2, float, aggregate<float>, CartDecomposition<2,float>> g_dist(sz,domain,g);
 
-	g_dist.getDecomposition().write("Before_load_grid_decomposition");
-	g_dist.write("Before_Loaded_grid");
-
-	timer t;
-	t.start();
-	// Save the grid
-	g_dist.load("grid_dist_id.h5");
-	t.stop();
-
-	g_dist.write("Loaded_grid");
-	g_dist.getDecomposition().write("Loaded_grid_decomposition");
+	g_dist.load("grid_dist_id.h5" + std::to_string(v_cl.getProcessingUnits()));
 
 	auto it = g_dist.getDomainIterator();
 
 	size_t count = 0;
 
+	bool match = true;
 	while (it.isNext())
 	{
 		//key
@@ -134,7 +125,7 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_hdf5_load_test )
 
 		auto keyg = g_dist.getGKey(key);
 
-		BOOST_REQUIRE_EQUAL(g_dist.template get<0>(key), keyg.get(0));
+		match &= g_dist.template get<0>(key) == keyg.get(0);
 
 		++it;
 		count++;
@@ -150,6 +141,7 @@ BOOST_AUTO_TEST_CASE( grid_dist_id_hdf5_load_test )
 		sum += count_total.get(i);
 
 	BOOST_REQUIRE_EQUAL(sum, (size_t)k*k);
+	BOOST_REQUIRE_EQUAL(match,true);
 }
 
 
-- 
GitLab