LArSoft test utilities. More...
Namespaces | |
details | |
Classes | |
struct | BasicEnvironmentConfiguration |
Class holding a configuration for a test environment. More... | |
struct | BasicGeometryEnvironmentConfiguration |
Class holding a configuration for a test environment. More... | |
class | BasicTesterEnvironment |
Environment for a test. More... | |
struct | BoostCommandLineConfiguration |
Class holding a configuration for a Boost test fixture. More... | |
struct | DefaultSetupProviderClass |
A default implementation for provider setup class. More... | |
class | GeometryTesterEnvironment |
Environment for a geometry test. More... | |
class | NameSelector |
Manages a set of names. More... | |
class | ProviderList |
Container of service providers accessed by type and optional label. More... | |
struct | ProviderSetupClass |
Class to create and set up a new provider. More... | |
struct | ProviderSetupClass< detinfo::DetectorClocksStandard > |
Set up a detinfo::DetectorClocksStandard from a parameter set. More... | |
struct | ProviderSetupClass< detinfo::DetectorPropertiesStandard > |
Set up a detinfo::DetectorPropertiesStandard from a parameter set. More... | |
struct | ProviderSetupClass< detinfo::LArPropertiesStandard > |
Set up a detinfo::LArPropertiesStandard from a parameter set. More... | |
struct | SimpleEnvironmentSetupClass |
Environment helper to set up a service provider. More... | |
struct | SimpleEnvironmentSetupClass < detinfo::DetectorPropertiesStandard, TestEnv > |
Environment setup helper for DetectorPropertiesStandard. More... | |
struct | SimpleEnvironmentSetupClass < lar::example::ShowerCalibrationGaloreFromPID, TestEnv > |
Environment setup helper for ShowerCalibrationGaloreFromPID. More... | |
struct | SimpleEnvironmentSetupClass < lar::example::ShowerCalibrationGaloreScale, TestEnv > |
Environment setup helper for ShowerCalibrationGaloreScale. More... | |
struct | SimpleEnvironmentSetupClass< detinfo::DetectorClocksStandard, TestEnv > |
Environment setup helper for DetectorClocksStandard. More... | |
struct | SimpleEnvironmentSetupClass< detinfo::DetectorPropertiesStandard, TestEnv > |
Environment setup helper for DetectorPropertiesStandard. More... | |
struct | SimpleEnvironmentSetupClass< detinfo::LArPropertiesStandard, TestEnv > |
Environment setup helper for LArPropertiesStandard. More... | |
class | StopWatch |
Provides time interval measurements. More... | |
class | TesterEnvironment |
A test environment with some support for service providers. More... | |
class | TestSharedGlobalResource |
Utility class providing singleton objects to the derived classes. More... | |
Functions | |
template<> | |
std::unique_ptr< UnmovableDatumClass > | setupProvider< UnmovableDatumClass > () |
template<typename Prov , typename... Args> | |
std::unique_ptr< Prov > | setupProvider (Args &&...args) |
Function calling ProviderSetup<>::setup for the specified provider. More... | |
template<typename Prov , typename Interface , typename TestEnv > | |
Prov * | SimpleEnvironmentStandardSetupByName (TestEnv &env, std::string service_name) |
Basic implementation of a environment setup helper. More... | |
template<typename Prov , typename TestEnv > | |
Prov * | SimpleEnvironmentStandardSetupByName (TestEnv &env, std::string service_name) |
template<typename Prov , typename TestEnv > | |
Prov * | simpleEnvironmentSetup (TestEnv &env) |
Sets up a provider in a specified test environment. More... | |
template<typename CONFIG , typename TESTENV = TesterEnvironment<std::decay_t<CONFIG>>, typename... ARGS> | |
TESTENV | CreateTesterEnvironment (CONFIG &&config, ARGS...other_args) |
Constructs and returns a TesterEnvironment object. More... | |
LArSoft test utilities.
LArSoft libraries.
TESTENV testing::CreateTesterEnvironment | ( | CONFIG && | config, |
ARGS... | other_args | ||
) |
Constructs and returns a TesterEnvironment object.
CONFIG | type of configuration object (detected from arguments) |
TESTENV | type of the tester environment (default: TesterEnvironment) |
ARGS | pack of types of the remining constructor arguments (optional) |
config | the configuration object to be used |
other_args | the remaining arguments of the tester constructor |
This function creates and returns a tester environment. By default, the tester environment class is TesterEnvironment<CONFIG> and no additional constructor arguments are needed except for special needs. The simplest way to use the function with an already available configuration is:
auto TestEnv = testing::CreateTesterEnvironment(config);
where TestEnv is assigned a specialization of TesterEnvironment.
The template class TESTENV undergoes the following requirement:
The CONFIG object is subject to no special requirements besides the ones from TESTENV constructor.
Definition at line 985 of file unit_test_base.h.
std::unique_ptr<Prov> testing::setupProvider | ( | Args &&... | args | ) |
Function calling ProviderSetup<>::setup for the specified provider.
Function calling ProviderSetupClass<>::setup for the specified provider.
Prov | type of the provider to be created and set up |
Args | types of arguments to the setup function |
args | arguments to the setup function |
This function provides a function-like interface to the ProviderSetup classes. An example of its use to create an instance of MyProvider
is:
auto prov = testing::setupProvider<MyProv> (pset.get<fhicl::ParameterSet>("services.MyProviderService"));
if MyProvider
provider has a constructor taking a fhicl::ParameterSet.
Definition at line 99 of file ProviderTestHelpers.h.
std::unique_ptr<UnmovableDatumClass> testing::setupProvider< UnmovableDatumClass > | ( | ) |
Definition at line 74 of file ProviderList_test.cc.
Prov* testing::simpleEnvironmentSetup | ( | TestEnv & | env | ) |
Sets up a provider in a specified test environment.
Prov | type of the provider to be set up |
TestEnv | type of the environment |
env | the environment to be set up |
This function performs the over-simple set up of a provider. The set up is completely delegated to a SimpleEnvironmentSetupClass class. No such class is provided by default, and service implementers must write their own to allow this one to work.
Definition at line 233 of file ProviderTestHelpers.h.
|
inline |
Basic implementation of a environment setup helper.
Prov | type of provider being set up |
TestEnv | type of environment to set up |
Interface | (optional) type of interface being implemented |
The setup()
static method of this class implements a simple set up of a service provider Prov in an existing testing environment.
The setup() function:
The environment is expected to expose an interface equivalent to the one of testing::TesterEnvironment
. Use this as:
template <typename TestEnv> struct SimpleEnvironmentSetupClass<MyProv, TestEnv> : public SimpleEnvironmentStandardSetupClass<MyProv, TestEnv, MyInterface> { SimpleEnvironmentSetupClass(): SimpleEnvironmentStandardSetupClass<MyProvider, TestEnv, MyInterface>("MyService") {} };
to register a provider of type MyProvider that implements a provider interface MyInterface, reading its configuration from the service configuration of "MyService"
(that is, services.MyService
).
The environment is then expected to react to both MyProvider and MyInterface types:
env.Provider<MyProvider>(); env.Provider<MyInterface>();
both return a pointer to the same provider. If instead MyInterface is void
(default), no interface is registered.
Definition at line 206 of file ProviderTestHelpers.h.
|
inline |
Definition at line 215 of file ProviderTestHelpers.h.