diff --git a/Tests/Functional/Core/Std/Check.cpp b/Tests/Functional/Core/Std/Check.cpp index 2510c410af3ad5423d2a4fa39dfc15ff6a08ed47..4bb03a58d456984e6009f5248303278af85e9fa9 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; }