Macros | Functions
nestedValidation_01_t.cc File Reference
#include "boost/test/unit_test.hpp"
#include "fhiclcpp/ParameterSet.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 (GoodTuple)
 
 BOOST_AUTO_TEST_CASE (BadTuple1)
 
 BOOST_AUTO_TEST_CASE (BadTuple2)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (Nested Validation)

Definition at line 1 of file nestedValidation_01_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( GoodTuple  )

Definition at line 35 of file nestedValidation_01_t.cc.

36 {
37  string const good{"pars: [X, [Y, Z]]"s};
38  std::vector<std::string> const ref{"Y"s, "Z"s};
39  auto validatedConfig = validateConfig(good);
40  auto const& pars = validatedConfig().pars();
41  BOOST_TEST_REQUIRE(std::get<0>(pars) == "X"s);
42  BOOST_TEST_REQUIRE(std::get<1>(pars) == ref);
43 }
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 45 of file nestedValidation_01_t.cc.

46 {
47  string const bad{"pars: [ X ]"s};
48  BOOST_REQUIRE_THROW(validateConfig(bad), detail::validationException);
49 }
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 51 of file nestedValidation_01_t.cc.

52 {
53  string const bad{"pars: [ X, 1 ]"s};
54  BOOST_CHECK_THROW(validateConfig(bad), fhicl::exception);
55 }
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