Macros | Functions
bounded_sequences_with_defaults_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   (Bounded sequences with defaults)
 

Functions

 BOOST_AUTO_TEST_CASE (GoodArray)
 
 BOOST_AUTO_TEST_CASE (GoodTuple)
 
 BOOST_AUTO_TEST_CASE (BadSequence)
 
 BOOST_AUTO_TEST_CASE (BadTuple)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (Bounded sequences with defaults)

Definition at line 1 of file bounded_sequences_with_defaults_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( GoodArray  )

Definition at line 39 of file bounded_sequences_with_defaults_t.cc.

40 {
41  string const good{};
42  auto const& validated = validate<ArrayConfig>(good);
43  BOOST_TEST(validated().composers(0) == "Mahler"s);
44  BOOST_TEST(validated().composers(1) == "Elgar"s);
45 }
static QCString * s
Definition: config.cpp:1042
BOOST_AUTO_TEST_CASE ( GoodTuple  )

Definition at line 47 of file bounded_sequences_with_defaults_t.cc.

48 {
49  string const good{};
50  auto const& validated = validate<TupleConfig>(good);
51  BOOST_TEST(validated().ages.get<0>() == "David"s);
52  BOOST_TEST(validated().ages.get<1>() == 9u);
53 }
static QCString * s
Definition: config.cpp:1042
BOOST_AUTO_TEST_CASE ( BadSequence  )

Definition at line 55 of file bounded_sequences_with_defaults_t.cc.

56 {
57  string const bad{"composers: [Beethoven]"};
58  // Because the 'composers' parameter is a bounded sequence of atomic
59  // types, the preset_value function indirectly throws a
60  // fhicl::exception instead of a fhicl::detail::validationException.
61  // This should probably be fixed at some point.
62  BOOST_REQUIRE_THROW(validate<ArrayConfig>(bad), fhicl::exception);
63 }
unsigned int bad()
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
BOOST_AUTO_TEST_CASE ( BadTuple  )

Definition at line 65 of file bounded_sequences_with_defaults_t.cc.

66 {
67  string const bad{"ages: [Jenny]"};
68  BOOST_REQUIRE_THROW(validate<TupleConfig>(bad), detail::validationException);
69 }
unsigned int bad()