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

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   (KeyAssembler test)
 

Functions

 BOOST_AUTO_TEST_CASE (t1)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (KeyAssembler test)

Definition at line 1 of file key_assembler_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( t1  )

Definition at line 16 of file key_assembler_t.cc.

17 {
18  std::string const doc = "p1: {}\n"
19  "p3: {\n"
20  " a: else\n"
21  " b: []\n"
22  " d: [ 11, 12 ]\n"
23  " p4: { e: f }\n"
24  " g: [ {h1: i1}, {h2: i2} ]\n"
25  "}\n";
26  auto const pset = ParameterSet::make(doc);
27  auto const keys = pset.get_all_keys();
28  std::set<std::string> const sorted_keys{keys.begin(), keys.end()};
29 
30  auto const ref = {"p1",
31  "p3",
32  "p3.a",
33  "p3.b",
34  "p3.d",
35  "p3.d[0]",
36  "p3.d[1]",
37  "p3.p4",
38  "p3.p4.e",
39  "p3.g",
40  "p3.g[0]",
41  "p3.g[0].h1",
42  "p3.g[1]",
43  "p3.g[1].h2"};
44  std::set<std::string> const sorted_ref{ref.begin(), ref.end()};
45  BOOST_TEST(sorted_keys == sorted_ref);
46 }
std::string string
Definition: nybbler.cc:12
unique_ptr< InputSource > make(ParameterSet const &conf, InputSourceDescription &desc)
QCString doc