Macros | Functions
DatabaseSupport_t.cc File Reference
#include "boost/test/unit_test.hpp"
#include <string>
#include <vector>
#include "fhiclcpp/DatabaseSupport.h"
#include "fhiclcpp/ParameterSet.h"

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   (database test)
 

Functions

 BOOST_AUTO_TEST_CASE (no_nesting)
 
 BOOST_AUTO_TEST_CASE (two_nested)
 
 BOOST_AUTO_TEST_CASE (nested_vector)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (database test)

Definition at line 1 of file DatabaseSupport_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( no_nesting  )

Definition at line 13 of file DatabaseSupport_t.cc.

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 }
void decompose_fhicl(std::string const &filename, std::vector< std::string > &records, std::vector< std::string > &hashes)
BOOST_AUTO_TEST_CASE ( two_nested  )

Definition at line 23 of file DatabaseSupport_t.cc.

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 }
static ParameterSet make(intermediate_table const &tbl)
Definition: ParameterSet.cc:68
p
Definition: test.py:223
QTextStream & endl(QTextStream &s)
void decompose_fhicl(std::string const &filename, std::vector< std::string > &records, std::vector< std::string > &hashes)
BOOST_AUTO_TEST_CASE ( nested_vector  )

Definition at line 41 of file DatabaseSupport_t.cc.

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 }
static ParameterSet make(intermediate_table const &tbl)
Definition: ParameterSet.cc:68
p
Definition: test.py:223
QTextStream & endl(QTextStream &s)
void decompose_fhicl(std::string const &filename, std::vector< std::string > &records, std::vector< std::string > &hashes)