get_sequence_elements_t.cc
Go to the documentation of this file.
1 #define BOOST_TEST_MODULE (get sequence elements test)
2 
3 #include "boost/test/unit_test.hpp"
5 
6 #include <vector>
7 
8 using namespace fhicl;
9 using namespace std;
10 
14 };
15 
17 {
18  cet::filepath_lookup policy("FHICL_FILE_PATH");
19  std::string cfg_in("Sample.cfg");
20  pset = ParameterSet::make(cfg_in, policy);
21 }
22 
23 BOOST_FIXTURE_TEST_SUITE(sampleConfig, SampleConfigFixture)
24 
25 BOOST_AUTO_TEST_CASE(element_lookup)
26 {
27  BOOST_TEST(pset.get<int>("g[0]") == 1);
28  BOOST_TEST(pset.get<int>("h[0].h1") == 12);
29  BOOST_TEST(pset.get<int>("m[0]") == -1);
30  BOOST_TEST(pset.get<int>("vv[0][1]") == 2);
31 
32  BOOST_TEST(pset.get<std::string>("h[1].h2") == "h2");
33 }
34 
35 BOOST_AUTO_TEST_CASE(element_container_lookup)
36 {
37  auto const vec0 = pset.get<std::vector<int>>("vv[0]");
38  std::vector const ref0{1, 2, 3};
39  BOOST_TEST(vec0 == ref0);
40 
41  auto vec1 = pset.get<std::vector<int>>("vv[1]");
42  std::vector const ref1{2, 3, 4};
43  BOOST_TEST(vec1 == ref1);
44 }
45 
46 BOOST_AUTO_TEST_SUITE_END()
std::string string
Definition: nybbler.cc:12
static ParameterSet make(intermediate_table const &tbl)
Definition: ParameterSet.cc:68
struct vector vector
STL namespace.
BOOST_AUTO_TEST_CASE(element_lookup)