diff --git a/Core/TestMachinery/CoreFutestSuite.cpp b/Core/TestMachinery/CoreFutestSuite.cpp deleted file mode 100644 index 869de7ac0ef3c6c495ef283614086156b86984c6..0000000000000000000000000000000000000000 --- a/Core/TestMachinery/CoreFutestSuite.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// ************************************************************************** // -// -// BornAgain: simulate and fit scattering at grazing incidence -// -//! @file StandardSamples/CoreFutestSuite.cpp -//! @brief Implements class CoreFutestSuite. -//! -//! @homepage http://www.bornagainproject.org -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2015 -//! @authors Scientific Computing Group at MLZ Garching -//! @authors C. Durniak, M. Ganeva, G. Pospelov, W. Van Herck, J. Wuttke -// -// ************************************************************************** // - -#include "CoreFunctionalTest.h" -#include "CoreFutestSuite.h" - -CoreFutestSuite::CoreFutestSuite( - const FunctionalTestInfo* info) - : FutestSuite(info) -{ -} - -IFunctionalTest* CoreFutestSuite::getFunctionalTest() const -{ - return new CoreFunctionalTest( - getTestName(), getTestDescription(), getSimulation(), - getReferenceData(), getTestThreshold(), getReferenceFileName()); -} diff --git a/Core/TestMachinery/CoreFutestSuite.h b/Core/TestMachinery/CoreFutestSuite.h deleted file mode 100644 index 364d8de5a08917ad96b11b17ac9dbc20c1225730..0000000000000000000000000000000000000000 --- a/Core/TestMachinery/CoreFutestSuite.h +++ /dev/null @@ -1,35 +0,0 @@ -// ************************************************************************** // -// -// BornAgain: simulate and fit scattering at grazing incidence -// -//! @file StandardSamples/CoreFutestSuite.h -//! @brief Declares class CoreFutestSuite. -//! -//! @homepage http://www.bornagainproject.org -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2015 -//! @authors Scientific Computing Group at MLZ Garching -//! @authors C. Durniak, M. Ganeva, G. Pospelov, W. Van Herck, J. Wuttke -// -// ************************************************************************** // - -#ifndef COREFUNCTIONALTESTCOMPONENTSERVICE_H -#define COREFUNCTIONALTESTCOMPONENTSERVICE_H - -#include "FutestSuite.h" - -class FunctionalTestInfo; - -//! @class CoreFutestSuite -//! @ingroup standard_samples -//! @brief Contains all necessary information to compose core functional test. - -class BA_CORE_API_ CoreFutestSuite : public FutestSuite -{ -public: - CoreFutestSuite(const FunctionalTestInfo* info); - - IFunctionalTest* getFunctionalTest() const; -}; - -#endif diff --git a/Core/TestMachinery/FutestSuite.cpp b/Core/TestMachinery/FutestSuite.cpp index 9861d97fc1f14fe3523d47ad9ee89a4cc0c39ecc..990a13cef0b5dc6eab867c670e2c67db8079f144 100644 --- a/Core/TestMachinery/FutestSuite.cpp +++ b/Core/TestMachinery/FutestSuite.cpp @@ -28,13 +28,15 @@ #include "FTDistributions.h" #include "FutestSuite.h" -FutestSuite::FutestSuite(const FunctionalTestInfo* info) +FutestSuite::FutestSuite(const FunctionalTestInfo* info, + class IFunctionalTest* functionalTest(const FutestSuite*)) : m_info(info) , m_formfactor(0) , m_ft_distribution_2d(0) , m_ff_registry(0) , m_ft2d_registry(0) , m_current_component(0) + , m_functionalTest(functionalTest) { init_registry(m_info->m_component_registry_name); } diff --git a/Core/TestMachinery/FutestSuite.h b/Core/TestMachinery/FutestSuite.h index 10e2536e9e7dd3425281577f33458c3844716339..b0fba9c51b49d2f377650178f3acc81ce180e279 100644 --- a/Core/TestMachinery/FutestSuite.h +++ b/Core/TestMachinery/FutestSuite.h @@ -30,15 +30,16 @@ class BA_CORE_API_ FutestSuite { public: - FutestSuite(const class FunctionalTestInfo* info); + typedef class IFunctionalTest* (*get_futest_t) (const FutestSuite*); + FutestSuite(const class FunctionalTestInfo* info, get_futest_t functionalTest); virtual ~FutestSuite(); + class IFunctionalTest* getFunctionalTest() const { return (*m_functionalTest)(this); } virtual class IFormFactor* getFormFactor() const; virtual class IFTDistribution2D* getFTDistribution2D() const; virtual class GISASSimulation* getSimulation() const; virtual std::shared_ptr<class ISampleBuilder> getSampleBuilder() const; virtual OutputData<double>* getReferenceData() const; - virtual class IFunctionalTest* getFunctionalTest() const = 0; size_t getNumberOfComponents() const { return m_component_names.size(); } void initComponent(size_t component_index); @@ -47,7 +48,6 @@ public: std::string getReferenceFileName() const; const class FunctionalTestInfo* getTestInfo() const { return m_info; } -protected: void init_registry(const std::string& registry_name); std::string getTestName() const; std::string getTestDescription() const; @@ -61,6 +61,7 @@ protected: class TestFTDistribution2DRegistry* m_ft2d_registry; std::vector<std::string> m_component_names; size_t m_current_component; + get_futest_t m_functionalTest; }; #endif diff --git a/Core/TestMachinery/PyScriptFutestSuite.cpp b/Core/TestMachinery/PyScriptFutestSuite.cpp deleted file mode 100644 index 2c255b11817fa464ca6e8769f888dedc70d39813..0000000000000000000000000000000000000000 --- a/Core/TestMachinery/PyScriptFutestSuite.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// ************************************************************************** // -// -// BornAgain: simulate and fit scattering at grazing incidence -// -//! @file StandardSamples/PyScriptFutestSuite.cpp -//! @brief Implements class PyScriptFutestSuite. -//! -//! @homepage http://www.bornagainproject.org -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2015 -//! @authors Scientific Computing Group at MLZ Garching -//! @authors C. Durniak, M. Ganeva, G. Pospelov, W. Van Herck, J. Wuttke -// -// ************************************************************************** // - -#include "PyScriptFutestSuite.h" -#include "PyScriptFunctionalTest.h" - -PyScriptFutestSuite::PyScriptFutestSuite( - const FunctionalTestInfo* info) - : FutestSuite(info) -{ -} - -IFunctionalTest* PyScriptFutestSuite::getFunctionalTest() const -{ - return new PyScriptFunctionalTest( - getTestName(), getTestDescription(), getSimulation(), getTestThreshold()); -} diff --git a/Core/TestMachinery/PyScriptFutestSuite.h b/Core/TestMachinery/PyScriptFutestSuite.h deleted file mode 100644 index 6be8c372ece616ca4e1d89263376eb8d70f28b67..0000000000000000000000000000000000000000 --- a/Core/TestMachinery/PyScriptFutestSuite.h +++ /dev/null @@ -1,35 +0,0 @@ -// ************************************************************************** // -// -// BornAgain: simulate and fit scattering at grazing incidence -// -//! @file StandardSamples/PyScriptFutestSuite.h -//! @brief Declares class PyScriptFutestSuite. -//! -//! @homepage http://www.bornagainproject.org -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2015 -//! @authors Scientific Computing Group at MLZ Garching -//! @authors C. Durniak, M. Ganeva, G. Pospelov, W. Van Herck, J. Wuttke -// -// ************************************************************************** // - -#ifndef PYSCRIPTFUNCTIONALTESTCOMPONENTSERVICE_H -#define PYSCRIPTFUNCTIONALTESTCOMPONENTSERVICE_H - -#include "FutestSuite.h" - -class FunctionalTestInfo; - -//! @class PyScriptFutestSuite -//! @ingroup standard_samples -//! @brief Contains all necessary information to compose pyscript functional test. - -class BA_CORE_API_ PyScriptFutestSuite : public FutestSuite -{ -public: - PyScriptFutestSuite(const FunctionalTestInfo* info); - - IFunctionalTest* getFunctionalTest() const; -}; - -#endif diff --git a/GUI/coregui/utils/GUIFutestSuite.cpp b/GUI/coregui/utils/GUIFutestSuite.cpp deleted file mode 100644 index 3284808d333c2f29acefd28502aaf7c3900942dc..0000000000000000000000000000000000000000 --- a/GUI/coregui/utils/GUIFutestSuite.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// ************************************************************************** // -// -// BornAgain: simulate and fit scattering at grazing incidence -// -//! @file coregui/utils/GUIFutestSuite.cpp -//! @brief Implements class GUIFutestSuite. -//! -//! @homepage http://www.bornagainproject.org -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2016 -//! @authors Scientific Computing Group at MLZ Garching -//! @authors Céline Durniak, Marina Ganeva, David Li, Gennady Pospelov -//! @authors Walter Van Herck, Joachim Wuttke -// -// ************************************************************************** // - -#include "GUIFutestSuite.h" -#include "GUIFunctionalTest.h" - - -GUIFutestSuite::GUIFutestSuite(const FunctionalTestInfo* info) - : FutestSuite(info) -{ -} - -IFunctionalTest* GUIFutestSuite::getFunctionalTest() const -{ - return new GUIFunctionalTest( - getTestName(), getTestDescription(), getSimulation(), getTestThreshold()); -} diff --git a/GUI/coregui/utils/GUIFutestSuite.h b/GUI/coregui/utils/GUIFutestSuite.h deleted file mode 100644 index 89c68c8d15b3951d68dbd3ce5215c9a01e28664b..0000000000000000000000000000000000000000 --- a/GUI/coregui/utils/GUIFutestSuite.h +++ /dev/null @@ -1,36 +0,0 @@ -// ************************************************************************** // -// -// BornAgain: simulate and fit scattering at grazing incidence -// -//! @file coregui/utils/GUIFutestSuite.h -//! @brief Declares class GUIFutestSuite. -//! -//! @homepage http://www.bornagainproject.org -//! @license GNU General Public License v3 or higher (see COPYING) -//! @copyright Forschungszentrum Jülich GmbH 2016 -//! @authors Scientific Computing Group at MLZ Garching -//! @authors Céline Durniak, Marina Ganeva, David Li, Gennady Pospelov -//! @authors Walter Van Herck, Joachim Wuttke -// -// ************************************************************************** // - -#ifndef GUIFUNCTIONALTESTCOMPONENTSERVICE_H -#define GUIFUNCTIONALTESTCOMPONENTSERVICE_H - -#include "FutestSuite.h" - -class FunctionalTestInfo; - -//! @class GUIFutestSuite -//! @ingroup standard_samples -//! @brief Contains all necessary information to compose GUI functional test. - -class BA_CORE_API_ GUIFutestSuite : public FutestSuite -{ -public: - GUIFutestSuite(const FunctionalTestInfo* info); - - IFunctionalTest* getFunctionalTest() const; -}; - -#endif diff --git a/Tests/FunctionalTests/TestCore/CoreSuite.cpp b/Tests/FunctionalTests/TestCore/CoreSuite.cpp index e794aef5a7edb6f6c72ac3730c0585b71e6a7e5f..87cd2bd2b5e8e588d462b7106a2623dcaf35c741 100644 --- a/Tests/FunctionalTests/TestCore/CoreSuite.cpp +++ b/Tests/FunctionalTests/TestCore/CoreSuite.cpp @@ -13,9 +13,10 @@ // // ************************************************************************** // +#include "FutestSuite.h" #include "FunctionalTestRegistry.h" #include "FunctionalMultiTest.h" -#include "CoreFutestSuite.h" +#include "CoreFunctionalTest.h" //! Program CoreSuite, to run core functional tests. int main(int argc, char** argv) @@ -29,7 +30,10 @@ int main(int argc, char** argv) if( !info ) return 1; - CoreFutestSuite service(info); + FutestSuite service(info, [] (const FutestSuite* s) -> IFunctionalTest* { + return new CoreFunctionalTest( + s->getTestName(), s->getTestDescription(), s->getSimulation(), + s->getReferenceData(), s->getTestThreshold(), s->getReferenceFileName()); } ); FunctionalMultiTest test(test_name, service); test.runTest(); return test.analyseResults(); diff --git a/Tests/FunctionalTests/TestGUI/GUISuite.cpp b/Tests/FunctionalTests/TestGUI/GUISuite.cpp index 67e9041f7c4ca93d0964ccf212e73e7436df017d..0f138726b1c413b5a1c7812535b51328209f6087 100644 --- a/Tests/FunctionalTests/TestGUI/GUISuite.cpp +++ b/Tests/FunctionalTests/TestGUI/GUISuite.cpp @@ -14,10 +14,10 @@ // // ************************************************************************** // +#include "FutestSuite.h" #include "FunctionalTestRegistry.h" -#include "GUIFutestSuite.h" +#include "GUIFunctionalTest.h" #include "FunctionalMultiTest.h" -#include <iostream> //! The main function of GUITestSuite to run functional tests int main(int argc, char** argv) @@ -31,7 +31,10 @@ int main(int argc, char** argv) if( !info ) return 1; - GUIFutestSuite service(info); + FutestSuite service(info, [] (const FutestSuite* s) -> IFunctionalTest* { + return new GUIFunctionalTest( + s->getTestName(), s->getTestDescription(), + s->getSimulation(), s->getTestThreshold()); } ); FunctionalMultiTest test(test_name, service); test.runTest(); return test.analyseResults(); diff --git a/Tests/FunctionalTests/TestPyDump/PyDump.cpp b/Tests/FunctionalTests/TestPyDump/PyDump.cpp index e906903b2d255280f76c94e123ee0eae860d40be..1ede3b2cfaf618c1689ba273189d1148deebbb38 100644 --- a/Tests/FunctionalTests/TestPyDump/PyDump.cpp +++ b/Tests/FunctionalTests/TestPyDump/PyDump.cpp @@ -13,10 +13,10 @@ // // ************************************************************************** // +#include "FutestSuite.h" #include "FunctionalTestRegistry.h" #include "FunctionalMultiTest.h" -#include "PyScriptFutestSuite.h" -#include <iostream> +#include "PyScriptFunctionalTest.h" //! Program PySuite, to run pyscript functional tests. @@ -31,7 +31,10 @@ int main(int argc, char** argv) if( !info ) return 1; - PyScriptFutestSuite service(info); + FutestSuite service(info, [] (const FutestSuite* s) -> IFunctionalTest* { + return new PyScriptFunctionalTest( + s->getTestName(), s->getTestDescription(), + s->getSimulation(), s->getTestThreshold()); } ); FunctionalMultiTest test(test_name, service); test.runTest(); return test.analyseResults();