Skip to content
Snippets Groups Projects
Commit 8f066ab1 authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

FUnctionalTestFactory now ApplicationTestFactory

parent e2ecd26b
No related branches found
No related tags found
No related merge requests found
......@@ -17,10 +17,10 @@
#define APPOPTIONSDESCRIPTION_H
class ProgramOptions;
class FunctionalTestFactory;
class ApplicationTestFactory;
//! Adds command line and config file options
void AddApplicationOptions(ProgramOptions *p_options, FunctionalTestFactory *p_test_factory);
void AddApplicationOptions(ProgramOptions *p_options, ApplicationTestFactory *p_test_factory);
#endif // APPPROGRAMOPTIONS_H
......
......@@ -13,8 +13,8 @@
//
// ************************************************************************** //
#ifndef FUNCTIONALTESTFACTORY_H
#define FUNCTIONALTESTFACTORY_H
#ifndef APPLICATIONTESTFACTORY_H
#define APPLICATIONTESTFACTORY_H
#include <string>
#include <map>
......@@ -25,11 +25,11 @@
class TBenchmark;
class ProgramOptions;
class FunctionalTestFactory : public IFactory<std::string, IApplicationTest>
class ApplicationTestFactory : public IFactory<std::string, IApplicationTest>
{
public:
FunctionalTestFactory();
virtual ~FunctionalTestFactory();
ApplicationTestFactory();
virtual ~ApplicationTestFactory();
//! execute specified test
void execute(std::string name, ProgramOptions *p_options);
......@@ -50,8 +50,9 @@ private:
TBenchmark *m_benchmark;
};
void RegisterFunctionalTests(FunctionalTestFactory *p_test_factory);
void RegisterApplicationTests(ApplicationTestFactory *p_test_factory);
#endif // APPLICATIONTESTFACTORY_H
#endif // FUNCTIONALTESTFACTORY_H
......@@ -13,8 +13,8 @@
//
// ************************************************************************** //
#ifndef IFUNCTIONALTEST_H
#define IFUNCTIONALTEST_H
#ifndef IAPPLICATIONTEST_H
#define IAPPLICATIONTEST_H
#include <string>
#include "INamed.h"
......
......@@ -15,7 +15,7 @@
#include "AppOptionsDescription.h"
#include "ProgramOptions.h"
#include "FunctionalTestFactory.h"
#include "ApplicationTestFactory.h"
#include <boost/program_options/options_description.hpp>
......@@ -23,7 +23,7 @@ namespace bpo = boost::program_options;
//! Adds command line and config file options.
void AddApplicationOptions(ProgramOptions* p_options, FunctionalTestFactory *p_test_factory)
void AddApplicationOptions(ProgramOptions* p_options, ApplicationTestFactory *p_test_factory)
{
// general options
bpo::options_description general_options("General options");
......@@ -48,7 +48,7 @@ void AddApplicationOptions(ProgramOptions* p_options, FunctionalTestFactory *p_t
// functional tests options constructed from information carried by FunctionalTestFactory
bpo::options_description functional_test_options("Functional tests");
FunctionalTestFactory::iterator it = p_test_factory->begin();
ApplicationTestFactory::iterator it = p_test_factory->begin();
for(; it!= p_test_factory->end(); ++it) {
// it.first - test name, it.second - test description
if( (*it).first != "functest") {
......
......@@ -2,8 +2,8 @@
//
// BornAgain: simulate and fit scattering at grazing incidence
//
//! @file App/src/FunctionalTestFactory.cpp
//! @brief Implements class FunctionalTestFactory.
//! @file App/src/ApplicationTestFactory.cpp
//! @brief Implements class ApplicationTestFactory.
//
//! Homepage: apps.jcns.fz-juelich.de/BornAgain
//! License: GNU General Public License v3 or higher (see COPYING)
......@@ -13,7 +13,7 @@
//
// ************************************************************************** //
#include "FunctionalTestFactory.h"
#include "ApplicationTestFactory.h"
#include "TestBugs.h"
#include "TestConvolution.h"
#include "TestDetectorResolution.h"
......@@ -61,21 +61,21 @@
#include "TBenchmark.h"
FunctionalTestFactory::FunctionalTestFactory() : m_benchmark(0)
ApplicationTestFactory::ApplicationTestFactory() : m_benchmark(0)
{
setOwnObjects(true);
m_benchmark = new TBenchmark();
}
FunctionalTestFactory::~FunctionalTestFactory()
ApplicationTestFactory::~ApplicationTestFactory()
{
delete m_benchmark;
}
// print benchmark summary on the screen
void FunctionalTestFactory::print_benchmarks()
void ApplicationTestFactory::print_benchmarks()
{
std::cout << "--- TestFactory::print_benchmarks() ---" << std::endl;
Float_t rp, cp;
......@@ -84,7 +84,7 @@ void FunctionalTestFactory::print_benchmarks()
// execute specific functional tests
void FunctionalTestFactory::execute(std::string name, ProgramOptions *p_options)
void ApplicationTestFactory::execute(std::string name, ProgramOptions *p_options)
{
IApplicationTest *test(0);
try {
......@@ -106,7 +106,7 @@ void FunctionalTestFactory::execute(std::string name, ProgramOptions *p_options)
// run tests in profile mode
void FunctionalTestFactory::profile(std::string name, ProgramOptions *p_options)
void ApplicationTestFactory::profile(std::string name, ProgramOptions *p_options)
{
IApplicationTest *test(0);
try {
......@@ -125,7 +125,7 @@ void FunctionalTestFactory::profile(std::string name, ProgramOptions *p_options)
// execute all registered functional tests
void FunctionalTestFactory::execute_all(ProgramOptions *p_options)
void ApplicationTestFactory::execute_all(ProgramOptions *p_options)
{
CallbackMap_t::const_iterator it;
for(it=m_callbacks.begin(); it != m_callbacks.end(); ++it ) {
......@@ -137,7 +137,7 @@ void FunctionalTestFactory::execute_all(ProgramOptions *p_options)
// print on the screen names of registered tests
void FunctionalTestFactory::print_testnames()
void ApplicationTestFactory::print_testnames()
{
std::string help;
help += "TestFactory::print_testnames() -> Info. \n";
......@@ -151,7 +151,7 @@ void FunctionalTestFactory::print_testnames()
}
void RegisterFunctionalTests(FunctionalTestFactory *p_test_factory)
void RegisterApplicationTests(ApplicationTestFactory *p_test_factory)
{
p_test_factory->registerItem(
"roughness",
......
......@@ -13,7 +13,7 @@
//
// ************************************************************************** //
#include "FunctionalTestFactory.h"
#include "ApplicationTestFactory.h"
#include "DrawHelper.h"
#include "ProgramOptions.h"
#include "AppOptionsDescription.h"
......@@ -36,8 +36,8 @@ int main(int argc, char **argv)
std::cout << AppVersion::g_app_name << " "
<< AppVersion::GetVersionNumber() << std::endl;
FunctionalTestFactory test_factory;
RegisterFunctionalTests(&test_factory);
ApplicationTestFactory test_factory;
RegisterApplicationTests(&test_factory);
ProgramOptions command_line_options;
AddApplicationOptions(&command_line_options, &test_factory);
......@@ -65,7 +65,7 @@ int main(int argc, char **argv)
} else {
// loop over functional tests,
// run test if its name is present in command line
FunctionalTestFactory::iterator it = test_factory.begin();
ApplicationTestFactory::iterator it = test_factory.begin();
for(; it!= test_factory.end(); ++it) {
if( command_line_options.find( (*it).first ) )
test_factory.execute(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment