conditional_t.cc
Go to the documentation of this file.
1 #define BOOST_TEST_MODULE (keymap test)
2 
3 #include "CondConfig.h"
4 #include "boost/test/unit_test.hpp"
6 #include "fhiclcpp/types/Table.h"
7 
8 #include <iostream>
9 #include <string>
10 
11 namespace {
12 
13  using namespace fhicl;
14 
16  create_PSet(std::string const& file)
17  {
19  return ParameterSet::make(file, fpm);
20  }
21 }
22 
23 BOOST_AUTO_TEST_SUITE(types_keymap_test)
24 
26 {
27  std::string const file{"cond_01_t.fcl"};
28  Table<CondConfig> table{Name("pset")};
29  try {
30  table.validate(create_PSet(file).get<fhicl::ParameterSet>("pset"));
31  }
32  catch (fhicl::detail::validationException const& e) {
33  std::cout << e.what() << std::endl;
34  }
35 }
36 
38 {
39  std::string const file{"cond_02_t.fcl"};
40  Table<CondConfig> table{Name("pset")};
41  table.validate(create_PSet(file).get<fhicl::ParameterSet>("pset"));
42  BOOST_TEST(table().flag() == false);
43  BOOST_TEST(table().num2() == 4);
44  BOOST_TEST(table().shape() == "sphere");
45  BOOST_TEST(table().sphereParams().radius() == 7);
46 }
47 
49 {
50  std::string const file{"cond_03_t.fcl"};
51  Table<CondConfig> table{Name("pset")};
52  table.validate(create_PSet(file).get<fhicl::ParameterSet>("pset"));
53  BOOST_TEST(table().flag() == true);
54  int number{16};
55  BOOST_TEST(table().num1(number) == false);
56  BOOST_TEST(table().shape() == "box");
57  auto ref = {4, 9, 2};
58  auto hls = table().boxParams().halfLengths();
59  BOOST_TEST(hls() == ref, boost::test_tools::per_element{});
60  BOOST_TEST(table().boxParams().material() == "Wood");
62  BOOST_TEST(table().boxParams().boxName(name) == true);
63  BOOST_TEST(name == "Stan");
64 }
65 
66 BOOST_AUTO_TEST_SUITE_END()
static QCString name
Definition: declinfo.cpp:673
std::string string
Definition: nybbler.cc:12
static ParameterSet make(intermediate_table const &tbl)
Definition: ParameterSet.cc:68
ChannelGroupService::Name Name
const double e
BOOST_AUTO_TEST_CASE(cond_01_t)
char const * what() const noexcept override
QTextStream & endl(QTextStream &s)