DatabaseSupport_t.cc
Go to the documentation of this file.
1 #define BOOST_TEST_MODULE (database test)
2 
3 #include "boost/test/unit_test.hpp"
4 
5 #include <string>
6 #include <vector>
7 
10 
11 BOOST_AUTO_TEST_SUITE(database_support_test)
12 
14 {
15  std::vector<std::string> records;
16  std::vector<std::string> hashes;
17 
18  BOOST_CHECK_NO_THROW(fhicl::decompose_fhicl("db_0.fcl", records, hashes));
19  BOOST_TEST(records.size() == hashes.size());
20  BOOST_TEST(records.size() == 1ul);
21 }
22 
24 {
25  std::vector<std::string> records;
26  std::vector<std::string> hashes;
27 
29  auto const p = fhicl::ParameterSet::make("db_1.fcl", fpm);
30  std::cout << "\n";
31  std::cout << "Compact string:\n";
32  std::cout << p.to_compact_string() << std::endl;
33  std::cout << "Non compact string:\n";
34  std::cout << p.to_string() << std::endl;
35 
36  BOOST_CHECK_NO_THROW(fhicl::decompose_fhicl("db_1.fcl", records, hashes));
37  BOOST_TEST(records.size() == hashes.size());
38  BOOST_TEST(records.size() == 3ul);
39 }
40 
41 BOOST_AUTO_TEST_CASE(nested_vector)
42 {
43  std::vector<std::string> records;
44  std::vector<std::string> hashes;
45 
47  auto const p = fhicl::ParameterSet::make("db_2.fcl", fpm);
48  auto const v = p.get<std::vector<fhicl::ParameterSet>>("a");
49  std::cout << "\n";
50  std::cout << p.to_compact_string() << std::endl;
51  BOOST_TEST(v.size() == 2ul);
52 
53  BOOST_CHECK_NO_THROW(fhicl::decompose_fhicl("db_2.fcl", records, hashes));
54  BOOST_TEST(records.size() == hashes.size());
55  BOOST_TEST(records.size() == 3ul);
56 }
57 
58 BOOST_AUTO_TEST_SUITE_END()
static ParameterSet make(intermediate_table const &tbl)
Definition: ParameterSet.cc:68
p
Definition: test.py:223
BOOST_AUTO_TEST_CASE(no_nesting)
QTextStream & endl(QTextStream &s)
void decompose_fhicl(std::string const &filename, std::vector< std::string > &records, std::vector< std::string > &hashes)