#include "boost/test/unit_test.hpp"
#include "tools/fhicl_get_impl.h"
#include <initializer_list>
#include <iostream>
#include <tuple>
#include <vector>
Go to the source code of this file.
#define BOOST_TEST_MODULE (fhicl - get test) |
BOOST_AUTO_TEST_CASE |
( |
no_arguments |
| ) |
|
Definition at line 53 of file fhicl-get-test.cc.
57 BOOST_TEST(stdout ==
"");
58 BOOST_TEST(
stderr.find(
"Missing input configuration file.") !=
BOOST_AUTO_TEST_CASE |
( |
help_message |
| ) |
|
Definition at line 62 of file fhicl-get-test.cc.
66 BOOST_TEST(stdout.find(
"Usage: fhicl-get [options] [key] <file>") !=
BOOST_AUTO_TEST_CASE |
( |
missing_key |
| ) |
|
Definition at line 71 of file fhicl-get-test.cc.
74 run({
"--atom-as",
"string",
"fhicl-get-t.fcl"});
76 BOOST_TEST(stdout ==
"");
79 "A key must be specified unless the '--names-in' option is used.") !=
BOOST_AUTO_TEST_CASE |
( |
retrieve_string |
| ) |
|
Definition at line 83 of file fhicl-get-test.cc.
86 run({
"--atom-as",
"string",
"a.billy",
"fhicl-get-t.fcl"});
88 BOOST_TEST(stdout ==
"the kid\n");
BOOST_AUTO_TEST_CASE |
( |
retrieve_double |
| ) |
|
Definition at line 92 of file fhicl-get-test.cc.
95 run({
"--atom-as",
"double",
"c",
"fhicl-get-t.fcl"});
97 BOOST_TEST(stdout ==
"1.25\n");
BOOST_AUTO_TEST_CASE |
( |
retrieve_int |
| ) |
|
Definition at line 101 of file fhicl-get-test.cc.
104 run({
"--atom-as",
"int",
"d",
"fhicl-get-t.fcl"});
106 BOOST_TEST(stdout ==
"42\n");
BOOST_AUTO_TEST_CASE |
( |
retrieve_bool |
| ) |
|
Definition at line 110 of file fhicl-get-test.cc.
113 run({
"--atom-as",
"bool",
"e",
"fhicl-get-t.fcl"});
115 BOOST_TEST(stdout ==
"0\n");
BOOST_AUTO_TEST_CASE |
( |
retrieve_sequence_int |
| ) |
|
Definition at line 119 of file fhicl-get-test.cc.
122 run({
"--sequence-of",
"int",
"f",
"fhicl-get-t.fcl"});
124 BOOST_TEST(stdout ==
"1\n3\n");
BOOST_AUTO_TEST_CASE |
( |
unsupported_types |
| ) |
|
Definition at line 128 of file fhicl-get-test.cc.
131 run({
"--atom-as",
"float",
"e",
"fhicl-get-t.fcl"});
133 BOOST_TEST(stdout ==
"");
134 BOOST_TEST(
stderr.find(
"The specified type 'float' is not supported") !=
BOOST_AUTO_TEST_CASE |
( |
names_in_file |
| ) |
|
BOOST_AUTO_TEST_CASE |
( |
names_in_nonempty_table |
| ) |
|
BOOST_AUTO_TEST_CASE |
( |
names_in_empty_table |
| ) |
|
BOOST_AUTO_TEST_CASE |
( |
names_in_nonexistent_table_1 |
| ) |
|
Definition at line 162 of file fhicl-get-test.cc.
165 run({
"--names-in",
"g.h",
"fhicl-get-t.fcl"});
167 BOOST_TEST(stdout ==
"");
170 "A parameter with the fully-qualified key 'g.h' does not exist.") !=
BOOST_AUTO_TEST_CASE |
( |
names_in_nonexistent_table_2 |
| ) |
|
Definition at line 174 of file fhicl-get-test.cc.
177 run({
"--names-in",
"g.h",
"--allow-missing",
"fhicl-get-t.fcl"});
179 BOOST_TEST(stdout ==
"");
BOOST_AUTO_TEST_CASE |
( |
names_in_nontable |
| ) |
|
Definition at line 183 of file fhicl-get-test.cc.
186 run({
"--names-in",
"c",
"--allow-missing",
"fhicl-get-t.fcl"});
188 BOOST_TEST(stdout ==
"");
190 stderr.find(
"The parameter named 'c' does not have a table value.") !=