ValidateAtomicNumberConfiguration_test.cc File Reference

Validates the AtomicNumber service provider configuration. More...

#include "larexamples/Services/AtomicNumber/Providers/AtomicNumber.h"
#include "larcorealg/TestUtils/unit_test_base.h"
#include "fhiclcpp/types/Name.h"
#include <iostream>
#include <string>
#include <stdexcept>

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Validates the AtomicNumber service provider configuration.

Author
Gianluca Petrillo (petri.nosp@m.llo@.nosp@m.fnal..nosp@m.gov)
Date
April 18, 2016
See also
AtomicNumber.h

This test expects a single configuration file to be specified as first argument.

Definition in file ValidateAtomicNumberConfiguration_test.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 33 of file ValidateAtomicNumberConfiguration_test.cc.

33  {
34 
35  //
36  // configuration of the test
37  //
38 
39  // provide a test name;
40  // the path to the configuration file will be taken from the first parameter
42  (argc, argv, "ValidateAtomicNumberConfiguration_test");
43 
44  // set up a basic testing environment with that configuration
45  auto TesterEnv = testing::CreateTesterEnvironment(config);
46 
47  // create a configuration table; here the name is irrelevant
49  (fhicl::Name("AtomicNumberService"));
50 
51  // print the configuration
52  mf::LogVerbatim("ValidateAtomicNumberConfiguration") << std::string(80, '-')
53  << "\nAllowed configuration for AtomicNumber provider:";
54  providerConfig.print_allowed_configuration(std::cout);
55 
56  //
57  // test of the configuration
58  //
59 
60  mf::LogVerbatim("ValidateAtomicNumberConfiguration") << std::string(80, '-')
61  << "\nValidating configuration from '"
62  << config.ServiceParameterSetPath("AtomicNumberService")
63  << "' in '" << config.ConfigurationPath() << "':";
64  // this will trigger validation
65  // and throw fhicl::detail::validationException on error
66  providerConfig.validate_ParameterSet
67  (TesterEnv.ServiceParameters("AtomicNumberService"), { "service_type" });
68 
69  //
70  // done!
71  //
72  return 0;
73 } // main()
MaybeLogger_< ELseverityLevel::ELsev_info, true > LogVerbatim
std::string string
Definition: nybbler.cc:12
Class holding a configuration for a test environment.
static Config * config
Definition: config.cpp:1054
TESTENV CreateTesterEnvironment(CONFIG &&config, ARGS...other_args)
Constructs and returns a TesterEnvironment object.