Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
fhiclcpp
fhiclcpp
test
to_string_test.cc
Go to the documentation of this file.
1
#include "
fhiclcpp/ParameterSet.h
"
2
3
#include <cassert>
4
#include <string>
5
6
int
7
main
()
8
{
9
cet::filepath_lookup
policy(
"FHICL_FILE_PATH"
);
10
std::string
in(
"Sample.cfg"
);
11
12
auto
const
pset1 =
fhicl::ParameterSet::make
(in, policy);
13
auto
const
pset2 =
fhicl::ParameterSet::make
(pset1.to_string());
14
15
assert(pset1 == pset2);
16
17
assert(pset2.get<
int
>(
"a"
) == 1);
18
assert(pset2.get<
unsigned
int
>(
"a"
) == 1);
19
assert(pset2.get<
int
>(
"b"
) == -1);
20
// assert(pset2.get<unsigned int>("b", 0) == 0);
21
22
assert(pset2.get<
double
>(
"c"
) == 0.0);
23
assert(pset2.get<
double
>(
"d"
) == 0.5);
24
25
assert(pset2.get<
std::string
>(
"e"
).compare(
"rain"
) == 0);
26
assert(pset2.get<
std::string
>(
"f"
).compare(
"32"
) == 0);
27
assert(pset2.get<
int
>(
"f"
) == 32);
28
29
assert(pset2.get<std::vector<int>>(
"g"
)[2] == 3);
30
31
assert(pset2.get<std::vector<fhicl::ParameterSet>>(
"h"
)[1]
32
.get<
std::string
>(
"h2"
)
33
.compare(
"h2"
) == 0);
34
35
assert(pset2.get<
fhicl::ParameterSet
>(
"i"
)
36
.
get
<
fhicl::ParameterSet
>(
"i1"
)
37
.
get
<
std::string
>(
"i1_1"
)
38
.compare(
"test"
) == 0);
39
40
return
0;
41
}
// main()
string
std::string string
Definition:
nybbler.cc:12
fhicl::ParameterSet::make
static ParameterSet make(intermediate_table const &tbl)
Definition:
ParameterSet.cc:68
main
int main()
Definition:
to_string_test.cc:7
ParameterSet.h
cet::filepath_lookup
Definition:
filepath_maker.h:52
fhicl::ParameterSet::get
T get(std::string const &key) const
Definition:
ParameterSet.h:271
fhicl::ParameterSet
Definition:
ParameterSet.h:36
Generated by
1.8.11