Macros | Functions
nestedValidation_02_t.cc File Reference
#include "boost/test/unit_test.hpp"
#include "fhiclcpp/ParameterSet.h"
#include "fhiclcpp/types/Atom.h"
#include "fhiclcpp/types/Name.h"
#include "fhiclcpp/types/Sequence.h"
#include "fhiclcpp/types/Table.h"
#include "fhiclcpp/types/Tuple.h"
#include <string>

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   (Nested Validation)
 

Functions

 BOOST_AUTO_TEST_CASE (GoodTuple1)
 
 BOOST_AUTO_TEST_CASE (BadTuple1)
 
 BOOST_AUTO_TEST_CASE (BadTuple2)
 
 BOOST_AUTO_TEST_CASE (BadTuple3)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (Nested Validation)

Definition at line 1 of file nestedValidation_02_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( GoodTuple1  )

Definition at line 36 of file nestedValidation_02_t.cc.

37 {
38  string const good{"pars: [[A, [B]], [X, [Y, Z]]]"s};
39  std::vector<std::string> const ref1{"B"s};
40  std::vector<std::string> const ref2{"Y"s, "Z"s};
41  auto validatedConfig = validateConfig(good);
42  auto const& pars = validatedConfig().pars();
43  BOOST_TEST_REQUIRE(pars.size() == 2ull);
44  BOOST_TEST_REQUIRE(std::get<0>(pars[0]) == "A"s);
45  BOOST_TEST_REQUIRE(std::get<1>(pars[0]) == ref1);
46  BOOST_TEST_REQUIRE(std::get<0>(pars[1]) == "X"s);
47  BOOST_TEST_REQUIRE(std::get<1>(pars[1]) == ref2);
48 }
fhicl::Table< Config > validateConfig(std::string const &configStr)
BOOST_TEST_REQUIRE(static_cast< bool >(inFile))
static QCString * s
Definition: config.cpp:1042
BOOST_AUTO_TEST_CASE ( BadTuple1  )

Definition at line 50 of file nestedValidation_02_t.cc.

51 {
52  string const bad{"pars: [[A], [X, [Y, Z]]]"s};
53  BOOST_REQUIRE_THROW(validateConfig(bad), detail::validationException);
54 }
fhicl::Table< Config > validateConfig(std::string const &configStr)
unsigned int bad()
static QCString * s
Definition: config.cpp:1042
BOOST_AUTO_TEST_CASE ( BadTuple2  )

Definition at line 56 of file nestedValidation_02_t.cc.

57 {
58  string const bad{"pars: [[A]]"s};
59  BOOST_REQUIRE_THROW(validateConfig(bad), detail::validationException);
60 }
fhicl::Table< Config > validateConfig(std::string const &configStr)
unsigned int bad()
static QCString * s
Definition: config.cpp:1042
BOOST_AUTO_TEST_CASE ( BadTuple3  )

Definition at line 62 of file nestedValidation_02_t.cc.

63 {
64  string const bad{"pars: [[A, 7]]"s};
65  BOOST_REQUIRE_THROW(validateConfig(bad), fhicl::exception);
66 }
fhicl::Table< Config > validateConfig(std::string const &configStr)
unsigned int bad()
static QCString * s
Definition: config.cpp:1042
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33