From 80583e88bcbb1421c59497e866bc208209146e47 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Fri, 20 Nov 2020 15:57:39 +0100
Subject: [PATCH] Update and improve report from Std Check

---
 Tests/Functional/Core/Std/Check.cpp | 44 +++++++++++++++--------------
 1 file changed, 23 insertions(+), 21 deletions(-)

diff --git a/Tests/Functional/Core/Std/Check.cpp b/Tests/Functional/Core/Std/Check.cpp
index 2510c410af3..4bb03a58d45 100644
--- a/Tests/Functional/Core/Std/Check.cpp
+++ b/Tests/Functional/Core/Std/Check.cpp
@@ -31,34 +31,36 @@ bool checkSimulation(const std::string& name, const ISimulation& direct_simulati
     // Load reference if available
     ASSERT(name != "");
     try {
-        reference.reset(IntensityDataIOFactory::readOutputData(
-            FileSystemUtils::jointPath(BATesting::ReferenceDir_Std(), name + ".int.gz")));
+        const std::string refPath = FileSystemUtils::jointPath(
+            BATesting::ReferenceDir_Std(), name + ".int.gz");
+        std::cout << "- compare with reference: " << refPath << "\n";
+        reference.reset(IntensityDataIOFactory::readOutputData(refPath));
     } catch (const std::exception&) {
-        std::cout << "No reference found, but we proceed with the simulation to create a new one\n";
+        std::cout << "Failure: reference not found\n";
+        std::cout << "  note: we proceed with the simulation to create a new one\n";
     }
 
     // Compare with reference if available.
-    bool success = false;
     if (reference) {
         std::cout << "- check diff" << std::endl;
-        success = IntensityDataFunctions::checkRelativeDifference(*reference, *result_data, limit);
+        if (IntensityDataFunctions::checkRelativeDifference(*reference, *result_data, limit)) {
+            std::cout << "- success" << std::endl;
+            return true; // regular exit
+        }
+        std::cout << "Failure ..." << std::endl;
     }
 
-    // Save simulation if different from reference.
-    if (!success) {
-        std::cout << "- failure ..." << std::endl;
-        FileSystemUtils::createDirectories(BATesting::TestOutDir_Std());
-        std::string out_fname =
-            FileSystemUtils::jointPath(BATesting::TestOutDir_Std(), name + ".int.gz");
-        IntensityDataIOFactory::writeOutputData(*result_data, out_fname);
-        std::cout << "New simulation result stored in " << out_fname << "\n"
-                  << "To visualize an intensity map, use " << BABuild::buildBinDir()
-                  << "/plot_intensity_data.py;"
-                  << "   to plot a difference image, use " << BABuild::buildBinDir()
-                  << "/plot_intensity_data_diff.py\n"
-                  << "If the new result is correct, then move it to "
-                  << BATesting::ReferenceDir_Core() << "/\n";
-    }
+    // Save simulation, as it differs from reference.
+    FileSystemUtils::createDirectories(BATesting::TestOutDir_Std());
+    std::string out_fname =
+        FileSystemUtils::jointPath(BATesting::TestOutDir_Std(), name + ".int.gz");
+    IntensityDataIOFactory::writeOutputData(*result_data, out_fname);
+    std::cout << "New simulation result: " << out_fname << "\n"
+              << "To visualize an intensity map, use " << BABuild::buildBinDir() << "/plot_int.py;"
+              << "   to plot a difference image, use " << BABuild::buildBinDir()
+              << "/plot_diff_int.py\n"
+              << "If the new result is correct, then move it to "
+              << BATesting::ReferenceDir_Core() << "/\n";
 
-    return success;
+    return false;
 }
-- 
GitLab