From e8a0376b03f2b6705968aec0ac0ea2ff192dea46 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 3 Aug 2020 21:42:39 +0200
Subject: [PATCH] rm old SelfConsistenceTest/

---
 .../Core/SelfConsistenceTest/CMakeLists.txt   | 23 ------
 .../SelfConsistenceTest.cpp                   | 73 -------------------
 .../SelfConsistenceTest/SelfConsistenceTest.h | 42 -----------
 .../SelfConsistenceTestService.cpp            | 41 -----------
 .../SelfConsistenceTestService.h              | 28 -------
 .../Core/SelfConsistenceTest/main.cpp         | 22 ------
 6 files changed, 229 deletions(-)
 delete mode 100644 Tests/Functional/Core/SelfConsistenceTest/CMakeLists.txt
 delete mode 100644 Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTest.cpp
 delete mode 100644 Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTest.h
 delete mode 100644 Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTestService.cpp
 delete mode 100644 Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTestService.h
 delete mode 100644 Tests/Functional/Core/SelfConsistenceTest/main.cpp

diff --git a/Tests/Functional/Core/SelfConsistenceTest/CMakeLists.txt b/Tests/Functional/Core/SelfConsistenceTest/CMakeLists.txt
deleted file mode 100644
index 5f7ca44e1a7..00000000000
--- a/Tests/Functional/Core/SelfConsistenceTest/CMakeLists.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-############################################################################
-# Tests/Functional/Core/SelfConsistenceTest/CMakeLists.txt
-############################################################################
-
-set(test TestSelfConsistence)
-
-# CoreStandardTest cases:
-set(test_cases
-    SpecularWithSlicing
-    InstrumentDefinitionComparison
-    TOFResolutionComparison
-    PolarizedQAngleReflectivityPP
-    PolarizedQAngleReflectivityMM
-    )
-
-file(GLOB source_files "*.cpp")
-
-add_executable(${test} ${source_files})
-target_link_libraries(${test} BornAgainCore BornAgainTestMachinery)
-foreach(test_case ${test_cases})
-    add_test(${test}/${test_case}
-        ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${test} ${test_case})
-endforeach()
diff --git a/Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTest.cpp b/Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTest.cpp
deleted file mode 100644
index f1b61cba801..00000000000
--- a/Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTest.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-// ************************************************************************** //
-//
-//  BornAgain: simulate and fit scattering at grazing incidence
-//
-//! @file      Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTest.cpp
-//! @brief     Implements class SelfConsistenceTest.
-//!
-//! @homepage  http://www.bornagainproject.org
-//! @license   GNU General Public License v3 or higher (see COPYING)
-//! @copyright Forschungszentrum Jülich GmbH 2018
-//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
-//
-// ************************************************************************** //
-
-#include "Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTest.h"
-#include "BATesting.h"
-#include "Core/InputOutput/IntensityDataIOFactory.h"
-#include "Core/Instrument/IntensityDataFunctions.h"
-#include "Core/Simulation/Simulation.h"
-#include "Core/Tools/FileSystemUtils.h"
-#include <cassert>
-
-namespace
-{
-std::string composeName(std::string d_name, std::string test_name, size_t index)
-{
-    std::stringstream ss;
-    ss << index;
-    return FileSystemUtils::jointPath(d_name, test_name + ss.str() + ".int.gz");
-}
-} // namespace
-
-SelfConsistenceTest::SelfConsistenceTest(const std::string& name,
-                                         std::vector<std::unique_ptr<Simulation>> simulations,
-                                         double threshold)
-    : m_name(name), m_simulations(std::move(simulations)), m_threshold(threshold)
-{
-    assert(m_simulations.size() >= 2); // need at least two simulations to compare
-}
-
-bool SelfConsistenceTest::runTest()
-{
-    // Run simulation.
-    std::vector<std::unique_ptr<OutputData<double>>> results;
-    for (auto& simulation : m_simulations) {
-        simulation->runSimulation();
-        auto sim_result = simulation->result();
-        results.push_back(sim_result.data());
-    }
-
-    // Compare with reference if available.
-    bool success = true;
-    for (size_t i = 1, size = results.size(); i < size; ++i) {
-        const bool outcome =
-            IntensityDataFunctions::checkRelativeDifference(*results[i], *results[0], m_threshold);
-        if (!outcome) { // compose message and save results
-            std::stringstream ss;
-            ss << "Simulations 0 and " << i << " yield different results.\n"
-               << "Results are stored in\n";
-            const std::string output_dname = BATesting::SelfConsistenceOutputDir();
-            FileSystemUtils::createDirectories(output_dname);
-            for (size_t index : {size_t(0), i}) {
-                const std::string fname = composeName(output_dname, m_name, index);
-                IntensityDataIOFactory::writeOutputData(*results[index], fname);
-                ss << "- " << fname << "\n";
-            }
-            std::cout << ss.str();
-        }
-        success = success && outcome;
-    }
-
-    return success;
-}
diff --git a/Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTest.h b/Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTest.h
deleted file mode 100644
index 7f6e4875994..00000000000
--- a/Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTest.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// ************************************************************************** //
-//
-//  BornAgain: simulate and fit scattering at grazing incidence
-//
-//! @file      Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTest.h
-//! @brief     Defines class SelfConsistenceTest.
-//!
-//! @homepage  http://www.bornagainproject.org
-//! @license   GNU General Public License v3 or higher (see COPYING)
-//! @copyright Forschungszentrum Jülich GmbH 2018
-//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
-//
-// ************************************************************************** //
-
-#ifndef BORNAGAIN_TESTS_FUNCTIONAL_CORE_SELFCONSISTENCETEST_SELFCONSISTENCETEST_H
-#define BORNAGAIN_TESTS_FUNCTIONAL_CORE_SELFCONSISTENCETEST_SELFCONSISTENCETEST_H
-
-#include <memory>
-#include <string>
-#include <vector>
-
-class Simulation;
-
-//! A functional test of BornAgain/Core.
-//! Performs given simulations and compares their results with each other.
-
-class SelfConsistenceTest
-{
-public:
-    SelfConsistenceTest(const std::string& name,
-                        std::vector<std::unique_ptr<Simulation>> simulations, double threshold);
-    ~SelfConsistenceTest() = default;
-
-    bool runTest();
-
-private:
-    std::string m_name;
-    std::vector<std::unique_ptr<Simulation>> m_simulations;
-    double m_threshold;
-};
-
-#endif // BORNAGAIN_TESTS_FUNCTIONAL_CORE_SELFCONSISTENCETEST_SELFCONSISTENCETEST_H
diff --git a/Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTestService.cpp b/Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTestService.cpp
deleted file mode 100644
index 08562e4f067..00000000000
--- a/Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTestService.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-// ************************************************************************** //
-//
-//  BornAgain: simulate and fit scattering at grazing incidence
-//
-//! @file      Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTestService.cpp
-//! @brief     Implements class SelfConsistenceTestService.
-//!
-//! @homepage  http://www.bornagainproject.org
-//! @license   GNU General Public License v3 or higher (see COPYING)
-//! @copyright Forschungszentrum Jülich GmbH 2018
-//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
-//
-// ************************************************************************** //
-
-#include "Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTestService.h"
-#include "Core/Simulation/Simulation.h"
-#include "Core/StandardSamples/SampleBuilderFactory.h"
-#include "Core/StandardSamples/SimulationFactory.h"
-#include "Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTest.h"
-#include "Tests/Functional/Std/StandardTestCatalog.h"
-
-using sim_ptr = std::unique_ptr<Simulation>;
-using builder_ptr = std::unique_ptr<IMultiLayerBuilder>;
-
-bool SelfConsistenceTestService::execute(int argc, char** argv)
-{
-    assert(argc > 1);
-    StandardTestInfo info = StandardTestCatalog().testInfo(argv[1]);
-
-    std::vector<sim_ptr> simulations;
-    for (size_t i = 0, size = info.size(); i < size; ++i) {
-        builder_ptr builder(SampleBuilderFactory().createItem(info.m_sample_builder_names[i]));
-        sim_ptr simulation(SimulationFactory().createItem(info.m_simulation_names[i]));
-        simulation->setSampleBuilder(std::move(builder));
-        simulations.push_back(std::move(simulation));
-    }
-
-    auto test = std::make_unique<SelfConsistenceTest>(info.m_test_name, std::move(simulations),
-                                                      info.m_threshold);
-    return test->runTest();
-}
diff --git a/Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTestService.h b/Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTestService.h
deleted file mode 100644
index 00183f38982..00000000000
--- a/Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTestService.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// ************************************************************************** //
-//
-//  BornAgain: simulate and fit scattering at grazing incidence
-//
-//! @file      Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTestService.h
-//! @brief     Defines class SelfConsistenceTestService.
-//!
-//! @homepage  http://www.bornagainproject.org
-//! @license   GNU General Public License v3 or higher (see COPYING)
-//! @copyright Forschungszentrum Jülich GmbH 2018
-//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
-//
-// ************************************************************************** //
-
-#ifndef BORNAGAIN_TESTS_FUNCTIONAL_CORE_SELFCONSISTENCETEST_SELFCONSISTENCETESTSERVICE_H
-#define BORNAGAIN_TESTS_FUNCTIONAL_CORE_SELFCONSISTENCETEST_SELFCONSISTENCETESTSERVICE_H
-
-//! @class SelfConsistenceTestService
-//! @brief Contains static method to run self-consistence functional test from standalone
-//! executable.
-
-class SelfConsistenceTestService
-{
-public:
-    static bool execute(int argc, char** argv);
-};
-
-#endif // BORNAGAIN_TESTS_FUNCTIONAL_CORE_SELFCONSISTENCETEST_SELFCONSISTENCETESTSERVICE_H
diff --git a/Tests/Functional/Core/SelfConsistenceTest/main.cpp b/Tests/Functional/Core/SelfConsistenceTest/main.cpp
deleted file mode 100644
index d13fff8bdcd..00000000000
--- a/Tests/Functional/Core/SelfConsistenceTest/main.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-// ************************************************************************** //
-//
-//  BornAgain: simulate and fit scattering at grazing incidence
-//
-//! @file      Tests/Functional/Core/SelfConsistenceTest/main.cpp
-//! @brief     Implements program CoreStandardTest to run core functional tests
-//!
-//! @homepage  http://www.bornagainproject.org
-//! @license   GNU General Public License v3 or higher (see COPYING)
-//! @copyright Forschungszentrum Jülich GmbH 2018
-//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
-//
-// ************************************************************************** //
-
-#include "Tests/Functional/Core/SelfConsistenceTest/SelfConsistenceTestService.h"
-
-//! Runs CoreStandardTest on a standard simulation indicated by argv[1].
-
-int main(int argc, char** argv)
-{
-    return SelfConsistenceTestService::execute(argc, argv) ? 0 : 1;
-}
-- 
GitLab