From b8a0b934ffb248c9aff0b4e9e9b886fd1ce2599b Mon Sep 17 00:00:00 2001
From: Gennady Pospelov <g.pospelov@fz-juelich.de>
Date: Fri, 6 Dec 2013 15:29:03 +0100
Subject: [PATCH] New application option --functest with list of test name to
 visualize

---
 App/inc/IFunctionalTest.h                     |   1 +
 App/inc/TestFunctionalTests.h                 |  31 +++++
 App/src/AppOptionsDescription.cpp             |   9 +-
 App/src/FunctionalTestFactory.cpp             |   6 +
 App/src/TestFunctionalTests.cpp               |  50 +++++++++
 App/src/TestMiscellaneous.cpp                 |   3 +
 .../FunctionalTestRegistry.cpp                |  65 ++++++++++-
 .../FunctionalTestRegistry.cpp.autosave       | 102 -----------------
 Core/StandardSamples/FunctionalTestRegistry.h |   4 +
 Core/Tools/inc/FileSystem.h                   |  55 +++++++++
 Core/Tools/inc/Utils.h                        |  34 +-----
 Core/Tools/src/FileSystem.cpp                 | 106 ++++++++++++++++++
 Core/Tools/src/Utils.cpp                      |  74 ------------
 .../TestCore/IsGISAXS01/IsGISAXS01.cpp        |   8 +-
 cmake/scripts/BAConfigure.h.in                |   4 +-
 15 files changed, 336 insertions(+), 216 deletions(-)
 create mode 100644 App/inc/TestFunctionalTests.h
 create mode 100644 App/src/TestFunctionalTests.cpp
 delete mode 100644 Core/StandardSamples/FunctionalTestRegistry.cpp.autosave
 create mode 100644 Core/Tools/inc/FileSystem.h
 create mode 100644 Core/Tools/src/FileSystem.cpp

diff --git a/App/inc/IFunctionalTest.h b/App/inc/IFunctionalTest.h
index df6c84ffa9b..8a9cd77e157 100644
--- a/App/inc/IFunctionalTest.h
+++ b/App/inc/IFunctionalTest.h
@@ -44,6 +44,7 @@ protected:
     std::string m_output_path;
 };
 
+
 #endif // IFUNCTIONALTEST_H
 
 
diff --git a/App/inc/TestFunctionalTests.h b/App/inc/TestFunctionalTests.h
new file mode 100644
index 00000000000..3866b0b2065
--- /dev/null
+++ b/App/inc/TestFunctionalTests.h
@@ -0,0 +1,31 @@
+#ifndef TESTFUNCTIONALTESTS_H
+#define TESTFUNCTIONALTESTS_H
+
+
+#include "IFunctionalTest.h"
+#include "FunctionalTestRegistry.h"
+#include <string>
+#include <vector>
+
+//! Plot results of given functional test
+
+class TestFunctionalTests : public IFunctionalTest
+{
+public:
+    TestFunctionalTests();
+    virtual ~TestFunctionalTests() { }
+
+    virtual void execute();
+    virtual void finalise(){}
+private:
+    //! read names of functional tests from command line options and check if they are Ok
+    bool readTestNames();
+
+    FunctionalTestRegistry m_testRegistry;
+    std::vector<std::string> m_testNames;
+};
+
+
+#endif // TESTFUNCTIONALTESTS_H
+
+
diff --git a/App/src/AppOptionsDescription.cpp b/App/src/AppOptionsDescription.cpp
index d3631615393..ecf904cdf15 100644
--- a/App/src/AppOptionsDescription.cpp
+++ b/App/src/AppOptionsDescription.cpp
@@ -39,6 +39,9 @@ void AddApplicationOptions(ProgramOptions* p_options, FunctionalTestFactory *p_t
          "used in TestMesocrystal2")
         ("fitpreserve", bpo::value<int>()->default_value(1),
          "used in TestMesocrystal2")
+//            ("functest,f", bpo::value< std::vector<std::string> > ()->default_value(std::vector<std::string>(), ""), "List of functional tests to show.")
+            ("functest,f", bpo::value< std::vector<std::string> > ()->multitoken()->zero_tokens(), "List of functional tests to show.")
+// see http://stackoverflow.com/questions/1804514/how-to-accept-empty-value-in-boostprogram-options
     ;
 
     // there is no positional options (without '--' or '-' signs) at the moment
@@ -48,9 +51,13 @@ void AddApplicationOptions(ProgramOptions* p_options, FunctionalTestFactory *p_t
     FunctionalTestFactory::iterator it = p_test_factory->begin();
     for(; it!= p_test_factory->end(); ++it) {
         // it.first - test name, it.second - test description
-        functional_test_options.add_options()((*it).first.c_str(), (*it).second.c_str());
+        if( (*it).first != "functest") {
+            functional_test_options.add_options()((*it).first.c_str(), (*it).second.c_str());
+        }
     }
 
+    //p_options->addPositional("functest",-1);
+
     // adding options to the main option holder
     p_options->add(general_options).add(functional_test_options);
 }
diff --git a/App/src/FunctionalTestFactory.cpp b/App/src/FunctionalTestFactory.cpp
index ee96b13118d..587df55e830 100644
--- a/App/src/FunctionalTestFactory.cpp
+++ b/App/src/FunctionalTestFactory.cpp
@@ -56,6 +56,7 @@
 #include "TestSpecularMatrix.h"
 #include "TestToySimulation.h"
 #include "TestToyFitting.h"
+#include "TestFunctionalTests.h"
 
 #include "TBenchmark.h"
 
@@ -335,6 +336,11 @@ void RegisterFunctionalTests(FunctionalTestFactory *p_test_factory)
         IFactoryCreateFunction<TestToyFitting, IFunctionalTest>,
         "functional test: produces plots used in manual");
 
+    p_test_factory->registerItem(
+        "functest",
+        IFactoryCreateFunction<TestFunctionalTests, IFunctionalTest>,
+        "Represents functional test results in graphics form");
+
 
 }
 
diff --git a/App/src/TestFunctionalTests.cpp b/App/src/TestFunctionalTests.cpp
new file mode 100644
index 00000000000..2903fe62ac5
--- /dev/null
+++ b/App/src/TestFunctionalTests.cpp
@@ -0,0 +1,50 @@
+#include "TestFunctionalTests.h"
+#include "ProgramOptions.h"
+#include "MessageService.h"
+#include <iostream>
+#include <vector>
+#include <string>
+
+TestFunctionalTests::TestFunctionalTests()
+{
+
+}
+
+
+void TestFunctionalTests::execute()
+{
+    std::cout << "TestFunctionalTest::execute() -> Hello World." << std::endl;
+
+   if(!readTestNames()) return;
+
+
+}
+
+
+bool TestFunctionalTests::readTestNames()
+{
+    if (mp_options->find("functest")) {
+        m_testNames = (*mp_options)["functest"].as<std::vector<std::string> >();
+    }
+
+    bool areCorrectNames(true);
+    if(m_testNames.empty()) {
+        std::cout << "TestFunctionalTest::readTestNames() -> Info. No tests specified. Select one or more from list below." << std::endl;
+        areCorrectNames = false;
+    }
+
+    for(size_t i=0; i<m_testNames.size(); ++i) {
+        if(!m_testRegistry.isRegisteredName(m_testNames[i])) {
+            std::cout << "TestFunctionalTest::readTestNames() -> Info. Not registered test with name '" << m_testNames[i] << "'." << std::endl;
+            areCorrectNames = false;
+        }
+    }
+
+    if(areCorrectNames) {
+        return true;
+    } else {
+        m_testRegistry.printCatalogue();
+        std::cout << std::endl;
+        return false;
+    }
+}
diff --git a/App/src/TestMiscellaneous.cpp b/App/src/TestMiscellaneous.cpp
index e58fdda586e..bb2c8e60eee 100644
--- a/App/src/TestMiscellaneous.cpp
+++ b/App/src/TestMiscellaneous.cpp
@@ -74,6 +74,9 @@ void TestMiscellaneous::test_FunctionalTestRegistry()
     FunctionalTestRegistry tests;
     tests.printCatalogue();
 
+    tests.runTest("isgisaxs01");
+    std::cout << Utils::FileSystem::GetReferenceDataDir() << std::endl;
+
 }
 
 
diff --git a/Core/StandardSamples/FunctionalTestRegistry.cpp b/Core/StandardSamples/FunctionalTestRegistry.cpp
index 507fe24358c..c1c869bb258 100644
--- a/Core/StandardSamples/FunctionalTestRegistry.cpp
+++ b/Core/StandardSamples/FunctionalTestRegistry.cpp
@@ -1,13 +1,21 @@
 #include "FunctionalTestRegistry.h"
 #include "Exceptions.h"
+#include "SimulationRegistry.h"
+#include "FileSystem.h"
+#include "OutputDataIOFactory.h"
+#include "OutputDataFunctions.h"
 #include <iostream>
+#include <iomanip>
 
 FunctionalTestRegistry::Catalogue FunctionalTestRegistry::m_catalogue = FunctionalTestRegistry::Catalogue();
 
 
 void FunctionalTestRegistry::TestInfo::print()
 {
-    std::cout << m_name << " " << m_description << " " << m_reference << " " << m_threshold << std::endl;
+    std::cout << std::setw(12) << std::left << m_name << " | "
+              << std::setw(24) << std::left << m_description << " | "
+              << std::setw(12) << std::left << m_reference << " | "
+              << std::setw(6) << std::left  << m_threshold << std::endl;
 }
 
 
@@ -18,6 +26,7 @@ FunctionalTestRegistry::Catalogue::Catalogue()
         "isgisaxs01_reference.ima.gz", 2e-10);
 }
 
+
 void FunctionalTestRegistry::Catalogue::add(const std::string &name,
     const std::string &description, const std::string &reference, double threshold)
 {
@@ -34,15 +43,67 @@ void FunctionalTestRegistry::Catalogue::add(const std::string &name,
 
 void FunctionalTestRegistry::Catalogue::print()
 {
+    std::cout << "--- FunctionalTestRegistry::Catalogue::print() ---" << std::endl;
     for(catalogue_t::iterator it = m_data.begin(); it!= m_data.end(); ++it) {
         (*it).second.print();
     }
 }
 
+FunctionalTestRegistry::TestInfo FunctionalTestRegistry::Catalogue::getInfo(const std::string &name)
+{
+    catalogue_t::iterator it = m_data.find(name);
+    if( it == m_data.end() ) {
+        std::ostringstream ostr;
+        ostr << "FunctionalTestRegistry::Catalogue::getInfo() -> Error. "
+             << "Not existing test name '" << name << "'. "
+             << "Existing items are:" << std::endl;
+        for(catalogue_t::iterator it2 = m_data.begin(); it2!=m_data.end(); ++it2) {
+            ostr << (*it2).first << std::endl;
+        }
+        throw ExistingClassRegistrationException(ostr.str());
+    }
+    return m_data[name];
+}
+
+
+bool FunctionalTestRegistry::isRegisteredName(const std::string &name)
+{
+    if( m_catalogue.m_data.find(name) == m_catalogue.m_data.end() ) {
+        return false;
+    } else {
+        return true;
+    }
+}
+
 
 int FunctionalTestRegistry::runTest(const std::string &name)
 {
+    TestInfo test_info = m_catalogue.getInfo(name);
 
+    SimulationRegistry sim_registry;
+    Simulation *simulation = sim_registry.createSimulation(name);
+
+    std::string filename = Utils::FileSystem::GetReferenceDataDir() + test_info.m_reference;
+    OutputData<double> *reference = OutputDataIOFactory::readIntensityData(filename);
+
+    simulation->runSimulation();
+
+    OutputData<double> *result = simulation->getIntensityData();
+
+    double diff = OutputDataFunctions::GetDifference(*result,*reference);
+    bool status_ok(true);
+    if( diff > test_info.m_threshold ) status_ok=false;
+
+
+    std::cout << test_info.m_name << " " << test_info.m_description
+              << " " << diff
+            << " " << (status_ok ? "[OK]" : "[FAILED]") << std::endl;
+
+    delete reference;
+    delete result;
+    delete simulation;
+
+    return (status_ok ? 0 : 1);
 }
 
 
@@ -51,3 +112,5 @@ int FUNCTIONAL_TEST(const std::string &name)
     FunctionalTestRegistry tests;
     return tests.runTest(name);
 }
+
+
diff --git a/Core/StandardSamples/FunctionalTestRegistry.cpp.autosave b/Core/StandardSamples/FunctionalTestRegistry.cpp.autosave
deleted file mode 100644
index f181836b009..00000000000
--- a/Core/StandardSamples/FunctionalTestRegistry.cpp.autosave
+++ /dev/null
@@ -1,102 +0,0 @@
-#include "FunctionalTestRegistry.h"
-#include "Exceptions.h"
-#include "SimulationRegistry.h"
-#include <iostream>
-
-FunctionalTestRegistry::Catalogue FunctionalTestRegistry::m_catalogue = FunctionalTestRegistry::Catalogue();
-
-
-void FunctionalTestRegistry::TestInfo::print()
-{
-    std::cout << m_name << " " << m_description << " " << m_reference << " " << m_threshold << std::endl;
-}
-
-
-FunctionalTestRegistry::Catalogue::Catalogue()
-{
-    add("isgisaxs01",
-        "Mixture of cylinders and prisms without interference",
-        "isgisaxs01_reference.ima.gz", 2e-10);
-}
-
-
-void FunctionalTestRegistry::Catalogue::add(const std::string &name,
-    const std::string &description, const std::string &reference, double threshold)
-{
-    catalogue_t::iterator it = m_data.find(name);
-    if( it != m_data.end() ) {
-        throw ExistingClassRegistrationException("FunctionalTestRegistry::Catalogue::add() -> "
-                                                 "Error. Existing item " +name);
-    }
-
-    m_data[name] = TestInfo(name, description, reference, threshold);
-
-}
-
-
-void FunctionalTestRegistry::Catalogue::print()
-{
-    for(catalogue_t::iterator it = m_data.begin(); it!= m_data.end(); ++it) {
-        (*it).second.print();
-    }
-}
-
-
-int FunctionalTestRegistry::runTest(const std::string &name)
-{
-    SimulationRegistry sim_registry;
-    Simulation *simulation = sim_registry.createSimulation("isgisaxs01");
-    
-    std::string filename = path_to_data + "isgisaxs01_reference.ima.gz";
-    m_reference = OutputDataIOFactory::readIntensityData(filename);
-
-    simulation->runSimulation();
-
-    m_result = simulation->getIntensityData();
-    delete simulation;
-
-}
-
-
-int FUNCTIONAL_TEST(const std::string &name)
-{
-    FunctionalTestRegistry tests;
-    return tests.runTest(name);
-}
-
-
-
-void FunctionalTests::IsGISAXS01::run(const std::string &path_to_data)
-{
-
-    SimulationRegistry sim_registry;
-    Simulation *simulation = sim_registry.createSimulation("isgisaxs01");
-
-    // loading reference data
-    std::string filename = path_to_data + "isgisaxs01_reference.ima.gz";
-    m_reference = OutputDataIOFactory::readIntensityData(filename);
-
-    simulation->runSimulation();
-
-    m_result = simulation->getIntensityData();
-    delete simulation;
-}
-
-
-int FunctionalTests::IsGISAXS01::analyseResults()
-{
-    const double threshold(2e-10);
-
-    // Calculating average relative difference.
-    double diff = OutputDataFunctions::GetDifference(*m_result,*m_reference);
-
-    // Assess result.
-	bool status_ok(true);
-    if( diff > threshold ) status_ok=false;
-
-
-    std::cout << " diff " << diff << std::endl;
-    std::cout << m_name << " " << m_description << " " <<
-            (status_ok ? "[OK]" : "[FAILED]") << std::endl;
-    return (status_ok ? 0 : 1);
-}
diff --git a/Core/StandardSamples/FunctionalTestRegistry.h b/Core/StandardSamples/FunctionalTestRegistry.h
index d0746a095a7..aae93a6e1cd 100644
--- a/Core/StandardSamples/FunctionalTestRegistry.h
+++ b/Core/StandardSamples/FunctionalTestRegistry.h
@@ -38,12 +38,16 @@ public:
                  const std::string &reference, double threshold);
         void print();
         catalogue_t m_data;
+        TestInfo getInfo(const std::string &name);
     };
 
     void printCatalogue() { m_catalogue.print(); }
 
     int runTest(const std::string &name);
 
+    bool isRegisteredName(const std::string &name);
+
+
 private:
 
     static Catalogue m_catalogue;
diff --git a/Core/Tools/inc/FileSystem.h b/Core/Tools/inc/FileSystem.h
new file mode 100644
index 00000000000..8534450d7d2
--- /dev/null
+++ b/Core/Tools/inc/FileSystem.h
@@ -0,0 +1,55 @@
+#ifndef FILESYSTEM_H
+#define FILESYSTEM_H
+
+#include "WinDllMacros.h"
+#include <string>
+
+//! Utilities to deal with file system.
+
+namespace Utils {
+
+class BA_CORE_API_ FileSystem
+{
+public:
+    //! Returns path to the current (working) directory
+    static std::string GetWorkingPath();
+
+    //! Returns path to BornAgain home directory
+    static std::string GetHomePath();
+
+    //! Sets relative path, which is the path from working directory to executable module. The value is known only from argv[0] and should be set from outside
+    static void SetArgvPath(const std::string& argv0);
+    static std::string GetArgvPath();
+
+    //! Returns file extension
+    static std::string GetFileExtension(const std::string& name);
+
+    //! Returns true if name contains *.gz extension
+    static bool isGZipped(const std::string& name);
+
+    //! Returns file extension after stripping '.gz' if any
+    static std::string GetFileMainExtension(const std::string& name);
+
+    //! returns path to executable
+    static std::string GetPathToExecutable(const std::string& argv0=GetArgvPath());
+
+    //! returns absolute path to data taking into acount location of executable
+    static std::string GetPathToData(const std::string& rel_data_path, const std::string& argv0=GetArgvPath());
+
+    //! return path to the code source directory
+    static std::string GetSourceDir();
+
+    //! return path to the install directory
+    static std::string GetInstallDir();
+
+    //! return path to the reference data
+    static std::string GetReferenceDataDir();
+
+private:
+    static std::string m_argv0_path; //!< it's value of argv[0], i.e. the path from working directory to executable module including the name of executable module
+};
+
+}
+
+
+#endif
diff --git a/Core/Tools/inc/Utils.h b/Core/Tools/inc/Utils.h
index 230d4bd0ebd..42a91da97c5 100644
--- a/Core/Tools/inc/Utils.h
+++ b/Core/Tools/inc/Utils.h
@@ -19,6 +19,7 @@
 #include "WinDllMacros.h"
 #include "Types.h"
 #include "Exceptions.h"
+#include "FileSystem.h"
 #include <boost/unordered_map.hpp>
 #include <map>
 
@@ -82,39 +83,6 @@ private:
     nstringmap_t m_nstringmap;
 };
 
-//! Utilities to deal with file system.
-
-class BA_CORE_API_ FileSystem
-{
-public:
-    //! Returns path to the current (working) directory
-    static std::string GetWorkingPath();
-
-    //! Returns path to BornAgain home directory
-    static std::string GetHomePath();
-
-    //! Sets relative path, which is the path from working directory to executable module. The value is known only from argv[0] and should be set from outside
-    static void SetArgvPath(const std::string& argv0);
-    static std::string GetArgvPath();
-
-    //! Returns file extension
-    static std::string GetFileExtension(const std::string& name);
-
-    //! Returns true if name contains *.gz extension
-    static bool isGZipped(const std::string& name);
-
-    //! Returns file extension after stripping '.gz' if any
-    static std::string GetFileMainExtension(const std::string& name);
-
-    //! returns path to executable
-    static std::string GetPathToExecutable(const std::string& argv0=GetArgvPath());
-
-    //! returns absolute path to data taking into acount location of executable
-    static std::string GetPathToData(const std::string& rel_data_path, const std::string& argv0=GetArgvPath());
-
-private:
-    static std::string m_argv0_path; //!< it's value of argv[0], i.e. the path from working directory to executable module including the name of executable module
-};
 
 //! Adjust length of the string, padding with blanks.
 
diff --git a/Core/Tools/src/FileSystem.cpp b/Core/Tools/src/FileSystem.cpp
new file mode 100644
index 00000000000..fcf72cc972e
--- /dev/null
+++ b/Core/Tools/src/FileSystem.cpp
@@ -0,0 +1,106 @@
+#include "FileSystem.h"
+#include "BAConfigure.h"
+#include "Exceptions.h"
+#include <boost/filesystem.hpp>
+
+
+std::string Utils::FileSystem::m_argv0_path = std::string();
+
+void Utils::FileSystem::SetArgvPath(const std::string& argv0)
+{
+    m_argv0_path = argv0;
+}
+
+std::string Utils::FileSystem::GetArgvPath()
+{
+    return m_argv0_path;
+}
+
+
+//! Returns path to the current (working) directory.
+
+std::string Utils::FileSystem::GetWorkingPath()
+{
+    return boost::filesystem::current_path().string();
+}
+
+//! Returns path to BornAgain home directory.
+
+std::string Utils::FileSystem::GetHomePath()
+{
+    throw NotImplementedException("Utils::FileSystem::GetHomePath()-> Not implemented anymore...");
+    return std::string();
+}
+
+std::string Utils::FileSystem::GetPathToExecutable(const std::string& argv0)
+{
+    std::string result = boost::filesystem::canonical( argv0.c_str() ).parent_path().string();
+    return result;
+}
+
+
+std::string Utils::FileSystem::GetPathToData(const std::string& rel_data_path, const std::string& argv0)
+{
+//#ifdef _WIN32
+//    // windows build place executable in additional sub-directory 'release'
+//    std::string result = (boost::filesystem::canonical( argv0.c_str() ).parent_path() / boost::filesystem::path("../") / boost::filesystem::path(rel_data_path)).string();
+//#else
+    std::string result = (boost::filesystem::canonical( argv0.c_str() ).parent_path() / boost::filesystem::path(rel_data_path)).string();
+//#endif
+    return result;
+}
+
+//! Returns file extension.
+
+std::string Utils::FileSystem::GetFileExtension(const std::string& name)
+{
+    return boost::filesystem::extension(name.c_str());
+}
+
+//! Does name contain *.gz extension?
+
+bool Utils::FileSystem::isGZipped(const std::string& name)
+{
+    static const std::string gzip_extension(".gz");
+    if ( Utils::FileSystem::GetFileExtension(name) == gzip_extension)
+        return true;
+    return false;
+}
+
+//! Returns file main extension (without .gz).
+
+std::string Utils::FileSystem::GetFileMainExtension(const std::string& name)
+{
+    if( !isGZipped(name) ) {
+        return Utils::FileSystem::GetFileExtension(name);
+    } else {
+        std::string stripped_name = name.substr(0, name.size()-3);
+        return Utils::FileSystem::GetFileExtension(stripped_name);
+    }
+}
+
+
+std::string Utils::FileSystem::GetSourceDir()
+{
+#ifdef BORNAGAIN_SOURCE_DIR
+    return std::string(BORNAGAIN_SOURCE_DIR );
+#else
+    throw LogicErrorException("Utils::FileSystem::GetSourceDir() -> Error. Not configured.");
+#endif
+}
+
+std::string Utils::FileSystem::GetInstallDir()
+{
+#ifdef BORNAGAIN_INSTALL_DIR
+    return std::string(BORNAGAIN_INSTALL_DIR);
+#else
+    throw LogicErrorException("Utils::FileSystem::GetInstallDir() -> Error. Not configured.");
+#endif
+}
+
+std::string Utils::FileSystem::GetReferenceDataDir()
+{
+    return GetSourceDir() + std::string("/Tests/ReferenceData/BornAgain/");
+}
+
+
diff --git a/Core/Tools/src/Utils.cpp b/Core/Tools/src/Utils.cpp
index 7db825b92b0..207ad3900bc 100644
--- a/Core/Tools/src/Utils.cpp
+++ b/Core/Tools/src/Utils.cpp
@@ -19,7 +19,6 @@
 #include <iomanip>
 #include <boost/regex.hpp>
 #include <boost/algorithm/string/replace.hpp>
-#include <boost/filesystem.hpp>
 #include <boost/algorithm/string.hpp>
 
 #ifdef DEBUG_FPE
@@ -30,7 +29,6 @@
 #endif
 
 
-std::string Utils::FileSystem::m_argv0_path = std::string();
 
 //! Parse double values from string to vector of double
 
@@ -109,78 +107,6 @@ std::vector<std::string> Utils::String::Split(
 }
 
 
-void Utils::FileSystem::SetArgvPath(const std::string& argv0)
-{
-	m_argv0_path = argv0;
-}
-
-std::string Utils::FileSystem::GetArgvPath()
-{
-	return m_argv0_path;
-}
-
-
-//! Returns path to the current (working) directory.
-
-std::string Utils::FileSystem::GetWorkingPath()
-{
-    return boost::filesystem::current_path().string();
-}
-
-//! Returns path to BornAgain home directory.
-
-std::string Utils::FileSystem::GetHomePath()
-{
-    throw NotImplementedException("Utils::FileSystem::GetHomePath()-> Not implemented anymore...");
-    return std::string();
-}
-
-std::string Utils::FileSystem::GetPathToExecutable(const std::string& argv0)
-{
-    std::string result = boost::filesystem::canonical( argv0.c_str() ).parent_path().string();
-    return result;
-}
-
-
-std::string Utils::FileSystem::GetPathToData(const std::string& rel_data_path, const std::string& argv0)
-{
-//#ifdef _WIN32
-//    // windows build place executable in additional sub-directory 'release'
-//    std::string result = (boost::filesystem::canonical( argv0.c_str() ).parent_path() / boost::filesystem::path("../") / boost::filesystem::path(rel_data_path)).string();
-//#else
-    std::string result = (boost::filesystem::canonical( argv0.c_str() ).parent_path() / boost::filesystem::path(rel_data_path)).string();
-//#endif
-    return result;
-}
-
-//! Returns file extension.
-
-std::string Utils::FileSystem::GetFileExtension(const std::string& name)
-{
-    return boost::filesystem::extension(name.c_str());
-}
-
-//! Does name contain *.gz extension?
-
-bool Utils::FileSystem::isGZipped(const std::string& name)
-{
-    static const std::string gzip_extension(".gz");
-    if ( Utils::FileSystem::GetFileExtension(name) == gzip_extension)
-        return true;
-    return false;
-}
-
-//! Returns file main extension (without .gz).
-
-std::string Utils::FileSystem::GetFileMainExtension(const std::string& name)
-{
-    if( !isGZipped(name) ) {
-        return Utils::FileSystem::GetFileExtension(name);
-    } else {
-        std::string stripped_name = name.substr(0, name.size()-3);
-        return Utils::FileSystem::GetFileExtension(stripped_name);
-    }
-}
 
 
 //! enables exception throw in the case of NaN, Inf
diff --git a/Tests/FunctionalTests/TestCore/IsGISAXS01/IsGISAXS01.cpp b/Tests/FunctionalTests/TestCore/IsGISAXS01/IsGISAXS01.cpp
index 56fa5f93737..7979b539880 100644
--- a/Tests/FunctionalTests/TestCore/IsGISAXS01/IsGISAXS01.cpp
+++ b/Tests/FunctionalTests/TestCore/IsGISAXS01/IsGISAXS01.cpp
@@ -7,6 +7,7 @@
 #include "MathFunctions.h"
 #include "SimulationRegistry.h"
 #include "OutputDataFunctions.h"
+#include "FunctionalTestRegistry.h"
 #include <iostream>
 #include <cmath>
 
@@ -64,8 +65,9 @@ std::string GetPathToData(int argc, char **argv)
 
 int main(int argc, char **argv)
 {
-    FunctionalTests::IsGISAXS01 test;
-    test.run(GetPathToData(argc, argv));
-    return test.analyseResults();
+//    FunctionalTests::IsGISAXS01 test;
+//    test.run(GetPathToData(argc, argv));
+//    return test.analyseResults();
+    return FUNCTIONAL_TEST("isgisaxs01");
 }
 #endif
diff --git a/cmake/scripts/BAConfigure.h.in b/cmake/scripts/BAConfigure.h.in
index e4ec526212c..08aecd8185a 100644
--- a/cmake/scripts/BAConfigure.h.in
+++ b/cmake/scripts/BAConfigure.h.in
@@ -3,7 +3,7 @@
 
 /* Configuration file will be automatically regenerated by CMake */
 
-#define BORNAGAIN_SOURCE_DIR     @CMAKE_SOURCE_DIR@
-#define BORNAGAIN_INSTALL_PREFIX @CMAKE_INSTALL_PREFIX@
+#define BORNAGAIN_SOURCE_DIR     "@CMAKE_SOURCE_DIR@"
+#define BORNAGAIN_INSTALL_DIR "@CMAKE_INSTALL_PREFIX@"
 
 #endif
-- 
GitLab