Public Member Functions | Protected Attributes | Private Types | List of all members
testing::TesterEnvironment< ConfigurationClass > Class Template Reference

A test environment with some support for service providers. More...

#include <unit_test_base.h>

Inheritance diagram for testing::TesterEnvironment< ConfigurationClass >:
testing::BasicTesterEnvironment< ConfigurationClass > testing::BasicTesterEnvironment< ConfigurationClass > testing::details::CommandLineArguments testing::details::CommandLineArguments testing::GeometryTesterEnvironment< CRMGeometryConfiguration > testing::GeometryTesterEnvironment< CRMGeometryConfiguration > testing::GeometryTesterEnvironment< StandardGeometryConfiguration > testing::GeometryTesterEnvironment< StandardGeometryConfiguration > testing::GeometryTesterEnvironment< ConfigurationClass > testing::GeometryTesterEnvironment< ConfigurationClass > GeometryCRMChannelMappingTestFixture GeometryGeoIDTestFixture GeometryIteratorTestFixture GeometryStandardChannelMappingTestFixture GeometryCRMChannelMappingTestFixture GeometryGeoIDTestFixture GeometryIteratorTestFixture GeometryStandardChannelMappingTestFixture

Public Member Functions

template<typename Prov , typename... Args>
Prov * SetupProvider (Args...args)
 Sets a service provider up by calling its testing::setupProvider() More...
 
template<typename Prov >
Prov * SetupProviderFromService (std::string name)
 Sets a service provider up by calling its testing::setupProvider() More...
 
template<typename Prov >
Prov * AcquireProvider (std::unique_ptr< Prov > &&prov)
 Acquires a service provider. More...
 
template<typename Interface , typename Prov , typename... Args>
Prov * SetupProviderFor (Args...args)
 Sets a provider up, recording it as implementation of Interface. More...
 
template<typename Interface , typename Prov >
Prov * SetupProviderFromServiceFor (std::string name)
 Sets a provider up, recording it as implementation of Interface. More...
 
template<typename Interface , typename Prov >
Prov * AcquireProviderFor (std::unique_ptr< Prov > &&prov)
 Acquires a service provider implementing an interface. More...
 
template<typename Prov >
Prov * SimpleProviderSetup ()
 Oversimplified provider setup. More...
 
template<typename Prov >
void DropProvider ()
 Removes and destroys the specified provider. More...
 
template<typename Prov >
Prov const * Provider () const
 Return the specified provider (throws if not available) More...
 
template<typename... Provs>
void FillProviderPack (gar::ProviderPack< Provs... > &pack) const
 Fills the specified provider pack with providers. More...
 
template<typename Prov >
Prov::providers_type ProviderPackFor () const
 Returns a provider pack for the specified provider. More...
 
template<typename Prov , typename... Args>
Prov * SetupProvider (Args &&...args)
 Sets a service provider up by calling its testing::setupProvider() More...
 
template<typename Prov , typename... Args>
Prov * SetupProviderFromService (std::string name, Args &&...args)
 Sets a service provider up by calling its testing::setupProvider() More...
 
template<typename Prov >
Prov * AcquireProvider (std::unique_ptr< Prov > &&prov)
 Acquires a service provider. More...
 
template<typename Interface , typename Prov , typename... Args>
Prov * SetupProviderFor (Args &&...args)
 Sets a provider up, recording it as implementation of Interface. More...
 
template<typename Interface , typename Prov , typename... Args>
Prov * SetupProviderFromServiceFor (std::string name, Args &&...args)
 Sets a provider up, recording it as implementation of Interface. More...
 
template<typename Interface , typename Prov >
Prov * AcquireProviderFor (std::unique_ptr< Prov > &&prov)
 Acquires a service provider implementing an interface. More...
 
template<typename Prov >
Prov * SimpleProviderSetup ()
 Oversimplified provider setup. More...
 
template<typename Prov >
void DropProvider ()
 Removes and destroys the specified provider. More...
 
template<typename Prov >
Prov const * Provider () const
 Return the specified provider (throws if not available) More...
 
template<typename... Provs>
void FillProviderPack (lar::ProviderPack< Provs... > &pack) const
 Fills the specified provider pack with providers. More...
 
template<typename Prov >
Prov::providers_type ProviderPackFor () const
 Returns a provider pack for the specified provider. More...
 
- Public Member Functions inherited from testing::BasicTesterEnvironment< ConfigurationClass >
 BasicTesterEnvironment (bool bSetup=true)
 Constructor: sets everything up and declares the test started. More...
 
virtual ~BasicTesterEnvironment ()
 Destructor: closing remarks. More...
 
 BasicTesterEnvironment (bool bSetup=true)
 Constructor: sets everything up and declares the test started. More...
 
virtual ~BasicTesterEnvironment ()
 Destructor: closing remarks. More...
 
 BasicTesterEnvironment (Configuration_t const &cfg_obj, bool bSetup=true)
 Setup from a configuration. More...
 
 BasicTesterEnvironment (Configuration_t &&cfg_obj, bool bSetup=true)
 
fhicl::ParameterSet const & Parameters () const
 Returns the full configuration. More...
 
fhicl::ParameterSet ServiceParameters (std::string service_name) const
 Returns the configuration of the specified service. More...
 
fhicl::ParameterSet TesterParameters (std::string test_name) const
 Returns the configuration of the specified test. More...
 
fhicl::ParameterSet TesterParameters () const
 Returns the configuration of the main test (undefined if no main test) More...
 
fhicl::ParameterSet const & Parameters () const
 Returns the full configuration. More...
 
fhicl::ParameterSet ServiceParameters (std::string service_name) const
 Returns the configuration of the specified service. More...
 
fhicl::ParameterSet TesterParameters (std::string test_name) const
 Returns the configuration of the specified test. More...
 
fhicl::ParameterSet TesterParameters () const
 Returns the configuration of the main test (undefined if no main test) More...
 
 BasicTesterEnvironment (Configuration_t const &configurer, bool bSetup=true)
 Setup from a configuration. More...
 
 BasicTesterEnvironment (Configuration_t &&configurer, bool bSetup=true)
 

Protected Attributes

ProviderList providers
 list of available providers More...
 

Private Types

using TesterEnvBase_t = BasicTesterEnvironment< ConfigurationClass >
 
using TesterEnv_t = TesterEnvironment< ConfigurationClass >
 
using TesterEnvBase_t = BasicTesterEnvironment< ConfigurationClass >
 
using TesterEnv_t = TesterEnvironment< ConfigurationClass >
 

Additional Inherited Members

- Public Types inherited from testing::BasicTesterEnvironment< ConfigurationClass >
using Configuration_t = ConfigurationClass
 
using Configuration_t = ConfigurationClass
 
- Static Public Member Functions inherited from testing::BasicTesterEnvironment< ConfigurationClass >
static fhicl::ParameterSet CompileParameterSet (std::string cfg)
 Compiles a parameter set from a string. More...
 
static fhicl::ParameterSet CompileParameterSet (std::string cfg)
 
- Protected Member Functions inherited from testing::BasicTesterEnvironment< ConfigurationClass >
Configuration_t const & Config () const
 Returns a read-only version of the configuration. More...
 
virtual void Setup ()
 The complete initialization, ran at construction by default. More...
 
virtual void Configure ()
 Reads and translates the configuration. More...
 
virtual fhicl::ParameterSet DefaultParameters () const
 Creates a full configuration for the test. More...
 
Configuration_t const & Config () const
 Returns a read-only version of the configuration. More...
 
virtual void Setup ()
 The complete initialization, ran at construction by default. More...
 
virtual void Configure ()
 Reads and translates the configuration. More...
 
virtual fhicl::ParameterSet DefaultParameters () const
 Creates a full configuration for the test. More...
 
virtual void SetupMessageFacility (fhicl::ParameterSet const &pset, std::string appl_name="") const
 Sets up the message facility. More...
 
virtual void SetupMessageFacility () const
 
virtual void SetupMessageFacility (fhicl::ParameterSet const &pset, std::string appl_name="") const
 Sets up the message facility. More...
 
virtual void SetupMessageFacility () const
 
- Static Protected Member Functions inherited from testing::BasicTesterEnvironment< ConfigurationClass >
static fhicl::ParameterSet ParseParameters (std::string config_path)
 Fills the test configuration from file or from default. More...
 
static fhicl::ParameterSet ParseParameters (std::string config_path)
 Fills the test configuration from file or from default. More...
 

Detailed Description

template<typename ConfigurationClass>
class testing::TesterEnvironment< ConfigurationClass >

A test environment with some support for service providers.

Template Parameters
ConfigurationClassa class providing compile-time configuration

This test environment extends BasicTesterEnvironment with some basic support for service providers.

Service provider support

This environment makes it available the method Provider<Prov>(), which returns a pointer to the provider of type Prov.

All providers must be set up after the test environment is constructed. The environment provides the following facilities:

The set up methods support a For variant (e.g. SetupProviderFor()) to register the provider also under the type of its interface. For example, if LArPropertiesStandard is an implementation of LArProperties, the call:

env.SetupProviderFor<LArProperties, LArPropertiesStandard>(pset);

will set up a LArPropertiesStandard provider just like

env.SetupProvider<LArPropertiesStandard>(pset);

would, and it makes the provider available as LArProperties too, so that both calls:

env.Provider<LArProperties>();
env.Provider<LArPropertiesStandard>();

are valid and return the same provider.

Use as test fixture

The providers must be set up after the test environment is constructed. This also means an additional complication for fixtures that require to be constructed in a final state, as it is the case for Boost unit test suite fixtures. In these cases, a class should publicly derive from TesterEnvironment, and the necessary setup should be added into the constructor of this derived class.

Note that, as in the case of BasicTesterEnvironment, in this case there is no room for polymorphism here since the setup need to happen on construction.

Definition at line 735 of file unit_test_base.h.

Member Typedef Documentation

template<typename ConfigurationClass>
using testing::TesterEnvironment< ConfigurationClass >::TesterEnv_t = TesterEnvironment<ConfigurationClass>
private

Definition at line 739 of file unit_test_base.h.

template<typename ConfigurationClass>
using testing::TesterEnvironment< ConfigurationClass >::TesterEnv_t = TesterEnvironment<ConfigurationClass>
private

Definition at line 750 of file unit_test_base.h.

template<typename ConfigurationClass>
using testing::TesterEnvironment< ConfigurationClass >::TesterEnvBase_t = BasicTesterEnvironment<ConfigurationClass>
private

Definition at line 738 of file unit_test_base.h.

template<typename ConfigurationClass>
using testing::TesterEnvironment< ConfigurationClass >::TesterEnvBase_t = BasicTesterEnvironment<ConfigurationClass>
private

Definition at line 749 of file unit_test_base.h.

Member Function Documentation

template<typename ConfigurationClass>
template<typename Prov >
Prov* testing::TesterEnvironment< ConfigurationClass >::AcquireProvider ( std::unique_ptr< Prov > &&  prov)
inline

Acquires a service provider.

Template Parameters
Provtype of provider
Parameters
provthe provider to be acquired
Returns
a pointer to the provider
See also
SetupProvider()
Exceptions
runtime_errorif the provider already exists

This method registers and takes ownership of the specified provider. It is similar to SetupProvider() except that user is in charge of the preliminary creation and setup of the provider.

Definition at line 798 of file unit_test_base.h.

799  {
800  if (!providers.acquire(std::move(prov)))
801  throw std::runtime_error("Provider already exists!");
802  return providers.getPointer<Prov>();
803  }
T const * getPointer(std::string label="") const
Retrieve the object of type T stored with the specified label.
Definition: ProviderList.h:355
bool acquire(std::unique_ptr< T > &&obj_ptr, std::string label="")
Registers and gets ownership of the specified object.
Definition: ProviderList.h:268
ProviderList providers
list of available providers
def move(depos, offset)
Definition: depos.py:107
template<typename ConfigurationClass>
template<typename Prov >
Prov* testing::TesterEnvironment< ConfigurationClass >::AcquireProvider ( std::unique_ptr< Prov > &&  prov)
inline

Acquires a service provider.

Template Parameters
Provtype of provider
Parameters
provthe provider to be acquired
Returns
a pointer to the provider
See also
SetupProvider()
Exceptions
runtime_errorif the provider already exists

This method registers and takes ownership of the specified provider. It is similar to SetupProvider() except that user is in charge of the preliminary creation and setup of the provider.

Definition at line 813 of file unit_test_base.h.

814  {
815  if (!providers.acquire(std::move(prov)))
816  throw std::runtime_error("Provider already exists!");
817  return providers.getPointer<Prov>();
818  }
T const * getPointer(std::string label="") const
Retrieve the object of type T stored with the specified label.
Definition: ProviderList.h:355
bool acquire(std::unique_ptr< T > &&obj_ptr, std::string label="")
Registers and gets ownership of the specified object.
Definition: ProviderList.h:268
ProviderList providers
list of available providers
def move(depos, offset)
Definition: depos.py:107
template<typename ConfigurationClass>
template<typename Interface , typename Prov >
Prov* testing::TesterEnvironment< ConfigurationClass >::AcquireProviderFor ( std::unique_ptr< Prov > &&  prov)
inline

Acquires a service provider implementing an interface.

Template Parameters
Provtype of provider
Interfacetype provider alias
Parameters
provthe provider to be acquired
Returns
a pointer to the provider
See also
SetupProviderFor(), AcquireProvider()

This method registers and takes ownership of the specified provider, like AcquireProvider() does. It also registers the provider as an implementation of Interface class, as SetupProviderFor does. It is similar to SetupProvider() except that user is in charge of the preliminar creation and setup of the provider.

Definition at line 870 of file unit_test_base.h.

871  {
872  auto prov_ptr = providers.acquire(prov);
873  providers.set_alias<Prov, Interface>();
874  return prov_ptr;
875  }
bool acquire(std::unique_ptr< T > &&obj_ptr, std::string label="")
Registers and gets ownership of the specified object.
Definition: ProviderList.h:268
ProviderList providers
list of available providers
bool set_alias(std::string alias_label="", std::string prov_label="")
Sets the Alias type as an alias of the Prov provider (with labels)
Definition: ProviderList.h:306
template<typename ConfigurationClass>
template<typename Interface , typename Prov >
Prov* testing::TesterEnvironment< ConfigurationClass >::AcquireProviderFor ( std::unique_ptr< Prov > &&  prov)
inline

Acquires a service provider implementing an interface.

Template Parameters
Provtype of provider
Interfacetype provider alias
Parameters
provthe provider to be acquired
Returns
a pointer to the provider
See also
SetupProviderFor(), AcquireProvider()

This method registers and takes ownership of the specified provider, like AcquireProvider() does. It also registers the provider as an implementation of Interface class, as SetupProviderFor does. It is similar to SetupProvider() except that user is in charge of the preliminar creation and setup of the provider.

Definition at line 887 of file unit_test_base.h.

888  {
889  auto prov_ptr = providers.acquire(prov);
890  providers.set_alias<Prov, Interface>();
891  return prov_ptr;
892  }
bool acquire(std::unique_ptr< T > &&obj_ptr, std::string label="")
Registers and gets ownership of the specified object.
Definition: ProviderList.h:268
ProviderList providers
list of available providers
bool set_alias(std::string alias_label="", std::string prov_label="")
Sets the Alias type as an alias of the Prov provider (with labels)
Definition: ProviderList.h:306
template<typename ConfigurationClass>
template<typename Prov >
void testing::TesterEnvironment< ConfigurationClass >::DropProvider ( )
inline

Removes and destroys the specified provider.

Template Parameters
Provtype of provider to be destroyed
Exceptions
runtime_errorif the provider was not present

Definition at line 898 of file unit_test_base.h.

899  {
900  if (!providers.erase<Prov>())
901  throw std::runtime_error("Provider not present!");
902  }
bool erase(std::string label="")
Drops the object with the specified type and label.
Definition: ProviderList.h:290
ProviderList providers
list of available providers
template<typename ConfigurationClass>
template<typename Prov >
void testing::TesterEnvironment< ConfigurationClass >::DropProvider ( )
inline

Removes and destroys the specified provider.

Template Parameters
Provtype of provider to be destroyed
Exceptions
runtime_errorif the provider was not present

Definition at line 915 of file unit_test_base.h.

916  {
917  if (!providers.erase<Prov>())
918  throw std::runtime_error("Provider not present!");
919  }
bool erase(std::string label="")
Drops the object with the specified type and label.
Definition: ProviderList.h:290
ProviderList providers
list of available providers
template<typename ConfigurationClass>
template<typename... Provs>
void testing::TesterEnvironment< ConfigurationClass >::FillProviderPack ( gar::ProviderPack< Provs... > &  pack) const
inline

Fills the specified provider pack with providers.

Exceptions
runtime_errorand everything provider() method can throw
See also
Provider()

Definition at line 915 of file unit_test_base.h.

916  {
917  details::ProviderPackFiller
918  <TesterEnv_t, gar::ProviderPack<Provs...>, Provs...>
919  ::fill
920  (*this, pack);
921  } // FillProviderPack()
Container for a list of pointers to providers.
Definition: ProviderPack.h:90
def fill(s)
Definition: translator.py:93
TesterEnvironment< ConfigurationClass > TesterEnv_t
template<typename ConfigurationClass>
template<typename... Provs>
void testing::TesterEnvironment< ConfigurationClass >::FillProviderPack ( lar::ProviderPack< Provs... > &  pack) const
inline

Fills the specified provider pack with providers.

Exceptions
runtime_errorand everything provider() method can throw
See also
Provider()

Definition at line 932 of file unit_test_base.h.

933  {
934  details::ProviderPackFiller
935  <TesterEnv_t, lar::ProviderPack<Provs...>, Provs...>
936  ::fill
937  (*this, pack);
938  } // FillProviderPack()
def fill(s)
Definition: translator.py:93
Container for a list of pointers to providers.
Definition: ProviderPack.h:114
TesterEnvironment< ConfigurationClass > TesterEnv_t
template<typename ConfigurationClass>
template<typename Prov >
Prov const* testing::TesterEnvironment< ConfigurationClass >::Provider ( ) const
inline

Return the specified provider (throws if not available)

Definition at line 906 of file unit_test_base.h.

907  { return providers.getPointer<Prov>(); }
T const * getPointer(std::string label="") const
Retrieve the object of type T stored with the specified label.
Definition: ProviderList.h:355
ProviderList providers
list of available providers
template<typename ConfigurationClass>
template<typename Prov >
Prov const* testing::TesterEnvironment< ConfigurationClass >::Provider ( ) const
inline

Return the specified provider (throws if not available)

Definition at line 923 of file unit_test_base.h.

924  { return providers.getPointer<Prov>(); }
T const * getPointer(std::string label="") const
Retrieve the object of type T stored with the specified label.
Definition: ProviderList.h:355
ProviderList providers
list of available providers
template<typename ConfigurationClass>
template<typename Prov >
Prov::providers_type testing::TesterEnvironment< ConfigurationClass >::ProviderPackFor ( ) const
inline

Returns a provider pack for the specified provider.

Template Parameters
Provtype of the provider
Exceptions
runtime_errorand everything provider() method can throw
See also
FillProviderPack()

The provider is required to have a providers_type type defined as an specialisation of gar::ProviderPack.

Definition at line 934 of file unit_test_base.h.

935  {
936  typename Prov::providers_type pack;
937  FillProviderPack(pack);
938  return pack;
939  } // ProviderPackFor()
void FillProviderPack(gar::ProviderPack< Provs... > &pack) const
Fills the specified provider pack with providers.
template<typename ConfigurationClass>
template<typename Prov >
Prov::providers_type testing::TesterEnvironment< ConfigurationClass >::ProviderPackFor ( ) const
inline

Returns a provider pack for the specified provider.

Template Parameters
Provtype of the provider
Exceptions
runtime_errorand everything provider() method can throw
See also
FillProviderPack()

The provider is required to have a providers_type type defined as an specialisation of lar::ProviderPack.

Definition at line 951 of file unit_test_base.h.

952  {
953  typename Prov::providers_type pack;
954  FillProviderPack(pack);
955  return pack;
956  } // ProviderPackFor()
void FillProviderPack(gar::ProviderPack< Provs... > &pack) const
Fills the specified provider pack with providers.
template<typename ConfigurationClass>
template<typename Prov , typename... Args>
Prov* testing::TesterEnvironment< ConfigurationClass >::SetupProvider ( Args...  args)
inline

Sets a service provider up by calling its testing::setupProvider()

Template Parameters
Provtype of provider
Argstype of arguments for the setup function
Parameters
argsarguments for the setup function
Returns
a pointer to the provider set up
Exceptions
runtime_errorif the provider already exists
See also
SetupProviderFor(), AcquireProvider()

A provider of type Prov is created, set up and recorded. Provider setup is delegated to testing::setupProvider function specific to the provider itself (that is, testing::setupProvider<Prov>(args...)) to which the setup arguments are forwarded. If the provider already exists, an exception is thrown.

Definition at line 761 of file unit_test_base.h.

762  {
763  if (!providers.setup<Prov>(std::forward<Args>(args)...))
764  throw std::runtime_error("Provider already exists!");
765  return providers.getPointer<Prov>();
766  }
T const * getPointer(std::string label="") const
Retrieve the object of type T stored with the specified label.
Definition: ProviderList.h:355
ProviderList providers
list of available providers
std::vector< std::string > args
command line arguments (from argv[0])
bool setup(Args &&...args)
Construct and register an object of type T with specified arguments.
Definition: ProviderList.h:252
template<typename ConfigurationClass>
template<typename Prov , typename... Args>
Prov* testing::TesterEnvironment< ConfigurationClass >::SetupProvider ( Args &&...  args)
inline

Sets a service provider up by calling its testing::setupProvider()

Template Parameters
Provtype of provider
Argstype of arguments for the setup function
Parameters
argsarguments for the setup function
Returns
a pointer to the provider set up
Exceptions
runtime_errorif the provider already exists
See also
SetupProviderFor(), AcquireProvider()

A provider of type Prov is created, set up and recorded. Provider setup is delegated to testing::setupProvider function specific to the provider itself (that is, testing::setupProvider<Prov>(args...)) to which the setup arguments are forwarded. If the provider already exists, an exception is thrown.

Definition at line 772 of file unit_test_base.h.

773  {
774  if (!providers.setup<Prov>(std::forward<Args>(args)...))
775  throw std::runtime_error("Provider already exists!");
776  return providers.getPointer<Prov>();
777  }
T const * getPointer(std::string label="") const
Retrieve the object of type T stored with the specified label.
Definition: ProviderList.h:355
ProviderList providers
list of available providers
std::vector< std::string > args
command line arguments (from argv[0])
bool setup(Args &&...args)
Construct and register an object of type T with specified arguments.
Definition: ProviderList.h:252
template<typename ConfigurationClass>
template<typename Interface , typename Prov , typename... Args>
Prov* testing::TesterEnvironment< ConfigurationClass >::SetupProviderFor ( Args...  args)
inline

Sets a provider up, recording it as implementation of Interface.

Template Parameters
Interfacetype of provider interface being implemented
Provtype of provider
Argstype of arguments for the setup function
Parameters
argsarguments for the setup function
Returns
a pointer to the provider set up
See also
SetupProvider()

This method performs the same type of setup as SetupProvider(). In addition, it registers the provider as an implementation of Interface. This means that the provider can be obtained not only with provider<Prov>(), which returns a pointer to the actual class Prov, but also as provider<Interface>(), which returns a pointer to the base class Interface.

Definition at line 822 of file unit_test_base.h.

823  {
824  auto prov = SetupProvider<Prov>(std::forward<Args>(args)...);
825  providers.set_alias<Prov, Interface>();
826  return prov;
827  }
ProviderList providers
list of available providers
std::vector< std::string > args
command line arguments (from argv[0])
bool set_alias(std::string alias_label="", std::string prov_label="")
Sets the Alias type as an alias of the Prov provider (with labels)
Definition: ProviderList.h:306
template<typename ConfigurationClass>
template<typename Interface , typename Prov , typename... Args>
Prov* testing::TesterEnvironment< ConfigurationClass >::SetupProviderFor ( Args &&...  args)
inline

Sets a provider up, recording it as implementation of Interface.

Template Parameters
Interfacetype of provider interface being implemented
Provtype of provider
Argstype of arguments for the setup function
Parameters
argsarguments for the setup function
Returns
a pointer to the provider set up
See also
SetupProvider()

This method performs the same type of setup as SetupProvider(). In addition, it registers the provider as an implementation of Interface. This means that the provider can be obtained not only with provider<Prov>(), which returns a pointer to the actual class Prov, but also as provider<Interface>(), which returns a pointer to the base class Interface.

Definition at line 837 of file unit_test_base.h.

838  {
839  auto prov = SetupProvider<Prov>(std::forward<Args>(args)...);
840  providers.set_alias<Prov, Interface>();
841  return prov;
842  }
ProviderList providers
list of available providers
std::vector< std::string > args
command line arguments (from argv[0])
bool set_alias(std::string alias_label="", std::string prov_label="")
Sets the Alias type as an alias of the Prov provider (with labels)
Definition: ProviderList.h:306
template<typename ConfigurationClass>
template<typename Prov >
Prov* testing::TesterEnvironment< ConfigurationClass >::SetupProviderFromService ( std::string  name)
inline

Sets a service provider up by calling its testing::setupProvider()

Template Parameters
Provtype of provider
Argstype of arguments for the setup function
Parameters
argsarguments for the setup function
Returns
a pointer to the provider set up
See also
SetupProvider()
Exceptions
runtime_errorif the provider already exists

A provider of type Prov is created, set up and recorded. Provider setup is attempted by constructing the provider with a parameter set from the registered configuration of service with specified name.

Definition at line 782 of file unit_test_base.h.

783  { return SetupProvider<Prov>(this->ServiceParameters(name)); }
static QCString name
Definition: declinfo.cpp:673
fhicl::ParameterSet ServiceParameters(std::string service_name) const
Returns the configuration of the specified service.
template<typename ConfigurationClass>
template<typename Prov , typename... Args>
Prov* testing::TesterEnvironment< ConfigurationClass >::SetupProviderFromService ( std::string  name,
Args &&...  args 
)
inline

Sets a service provider up by calling its testing::setupProvider()

Template Parameters
Provtype of provider
Argstype of arguments for the setup function
Parameters
namethe service name (for configuration retrieval)
argsarguments for the setup function
Returns
a pointer to the provider set up
See also
SetupProvider()
Exceptions
runtime_errorif the provider already exists

A provider of type Prov is created, set up and recorded. Provider setup is attempted by constructing the provider with a parameter set from the registered configuration of service with specified name.

Definition at line 794 of file unit_test_base.h.

795  {
796  return SetupProvider<Prov>
797  (this->ServiceParameters(name, std::forward<Args>(args)...));
798  }
static QCString name
Definition: declinfo.cpp:673
std::vector< std::string > args
command line arguments (from argv[0])
fhicl::ParameterSet ServiceParameters(std::string service_name) const
Returns the configuration of the specified service.
template<typename ConfigurationClass>
template<typename Interface , typename Prov >
Prov* testing::TesterEnvironment< ConfigurationClass >::SetupProviderFromServiceFor ( std::string  name)
inline

Sets a provider up, recording it as implementation of Interface.

Template Parameters
Interfacetype of provider interface being implemented
Provtype of provider
Argstype of arguments for the setup function
Parameters
argsarguments for the setup function
Returns
a pointer to the provider set up
See also
SetupProviderFromService(), SetupProviderFor()
Exceptions
runtime_errorif the provider already exists

This method performs the same type of setup as SetupProviderFromService(). In addition, it registers the provider as an implementation of Interface. This means that the provider can be obtained not only with provider<Prov>(), which returns a pointer to the actual class Prov, but also as provider<Interface>(), which returns a pointer to the base class Interface.

Definition at line 848 of file unit_test_base.h.

849  {
850  auto prov = SetupProviderFromService<Prov>(name);
851  providers.set_alias<Prov, Interface>();
852  return prov;
853  }
static QCString name
Definition: declinfo.cpp:673
ProviderList providers
list of available providers
bool set_alias(std::string alias_label="", std::string prov_label="")
Sets the Alias type as an alias of the Prov provider (with labels)
Definition: ProviderList.h:306
template<typename ConfigurationClass>
template<typename Interface , typename Prov , typename... Args>
Prov* testing::TesterEnvironment< ConfigurationClass >::SetupProviderFromServiceFor ( std::string  name,
Args &&...  args 
)
inline

Sets a provider up, recording it as implementation of Interface.

Template Parameters
Interfacetype of provider interface being implemented
Provtype of provider
Argstype of arguments for the setup function
Parameters
namethe service name (for configuration retrieval)
argsarguments for the setup function
Returns
a pointer to the provider set up
See also
SetupProviderFromService(), SetupProviderFor()
Exceptions
runtime_errorif the provider already exists

This method performs the same type of setup as SetupProviderFromService(). In addition, it registers the provider as an implementation of Interface. This means that the provider can be obtained not only with provider<Prov>(), which returns a pointer to the actual class Prov, but also as provider<Interface>(), which returns a pointer to the base class Interface.

Definition at line 864 of file unit_test_base.h.

865  {
866  auto* prov
867  = SetupProviderFromService<Prov>(name, std::forward<Args>(args)...);
868  providers.set_alias<Prov, Interface>();
869  return prov;
870  }
static QCString name
Definition: declinfo.cpp:673
ProviderList providers
list of available providers
std::vector< std::string > args
command line arguments (from argv[0])
bool set_alias(std::string alias_label="", std::string prov_label="")
Sets the Alias type as an alias of the Prov provider (with labels)
Definition: ProviderList.h:306
template<typename ConfigurationClass>
template<typename Prov >
Prov* testing::TesterEnvironment< ConfigurationClass >::SimpleProviderSetup ( )
inline

Oversimplified provider setup.

Returns
a pointer to the provider
Template Parameters
Provprovider type

This is a one-step setup of the specified provider.

It is available only if Prov provider comes with an implementation of testing::SimpleEnvironmentSetupClass that explains how to set up an environment.

Definition at line 890 of file unit_test_base.h.

890 { return simpleEnvironmentSetup<Prov>(*this); }
template<typename ConfigurationClass>
template<typename Prov >
Prov* testing::TesterEnvironment< ConfigurationClass >::SimpleProviderSetup ( )
inline

Oversimplified provider setup.

Returns
a pointer to the provider
Template Parameters
Provprovider type

This is a one-step setup of the specified provider.

It is available only if Prov provider comes with an implementation of testing::SimpleEnvironmentSetupClass that explains how to set up an environment.

Definition at line 907 of file unit_test_base.h.

907 { return simpleEnvironmentSetup<Prov>(*this); }

Member Data Documentation

template<typename ConfigurationClass>
ProviderList testing::TesterEnvironment< ConfigurationClass >::providers
protected

list of available providers

Definition at line 943 of file unit_test_base.h.


The documentation for this class was generated from the following file: