Macros | Functions
prune_config_t.cc File Reference
#include "boost/test/unit_test.hpp"
#include "art/Framework/Art/detail/prune_configuration.h"
#include "canvas/Utilities/Exception.h"
#include "fhiclcpp/intermediate_table.h"
#include "fhiclcpp/parse.h"
#include <string>

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   (prune_config test)
 

Functions

 BOOST_AUTO_TEST_CASE (empty_config)
 
 BOOST_AUTO_TEST_CASE (duplicate_label)
 
 BOOST_AUTO_TEST_CASE (inhomogeneous_path)
 
 BOOST_AUTO_TEST_CASE (nonexistent_path_1)
 
 BOOST_AUTO_TEST_CASE (nonexistent_path_2)
 
 BOOST_AUTO_TEST_CASE (unconfigured_label)
 
 BOOST_AUTO_TEST_CASE (illegal_label)
 
 BOOST_AUTO_TEST_CASE (illegal_action_for_non_filter)
 
 BOOST_AUTO_TEST_CASE (unconfigured_label_with_trigger_paths)
 
 BOOST_AUTO_TEST_CASE (misspecified_end_path)
 
 BOOST_AUTO_TEST_CASE (misspecified_trigger_path)
 
 BOOST_AUTO_TEST_CASE (unsupported_physics_parameters)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (prune_config test)

Definition at line 2 of file prune_config_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( empty_config  )

Definition at line 36 of file prune_config_t.cc.

37 {
38  check_configuration({});
39 }
BOOST_AUTO_TEST_CASE ( duplicate_label  )

Definition at line 41 of file prune_config_t.cc.

42 {
43  std::string const config{"process_name: \"test\" "
44  "physics: { "
45  " analyzers: { "
46  " p: { module_type: PMTestAnalyzer } "
47  " } "
48  " filters: { "
49  " p: { module_type: PMTestFilter } "
50  " } "
51  " p1: [ p ] "
52  "}"};
53  std::string const err_msg{
54  "---- Configuration BEGIN\n"
55  " An error occurred while processing module configurations.\n"
56  " Module label 'p' has been used in 'physics.analyzers' and "
57  "'physics.filters'.\n"
58  " Module labels must be unique across an art process.\n"
59  "---- Configuration END\n"};
60  check_exception(config, err_msg);
61 }
std::string string
Definition: nybbler.cc:12
static Config * config
Definition: config.cpp:1054
BOOST_AUTO_TEST_CASE ( inhomogeneous_path  )

Definition at line 63 of file prune_config_t.cc.

64 {
65  std::string const config{"process_name: \"test\" "
66  "physics: { "
67  " analyzers: { "
68  " a: { module_type: PMTestAnalyzer } "
69  " } "
70  " filters: { "
71  " f: { module_type: PMTestFilter } "
72  " } "
73  " producers: { "
74  " p: { module_type: PMTestProducer } "
75  " } "
76  " p1: [ f, p, a ] "
77  "}"};
78  std::string const err_msg{
79  "---- Configuration BEGIN\n"
80  " An error occurred while processing a path configuration.\n"
81  " The following modules specified in path p1 are observers when all\n"
82  " other modules are modifiers:\n"
83  " 'a'\n"
84  "---- Configuration END\n"};
85  check_exception(config, err_msg);
86 }
std::string string
Definition: nybbler.cc:12
static Config * config
Definition: config.cpp:1054
BOOST_AUTO_TEST_CASE ( nonexistent_path_1  )

Definition at line 88 of file prune_config_t.cc.

89 {
90  std::string const config{"physics.trigger_paths: [x1]"};
91  std::string const err_msg{
92  "---- Configuration BEGIN\n"
93  " The following error occurred while processing path configurations:\n"
94  " Unknown path x1 has been specified in 'trigger_paths'.\n"
95  "---- Configuration END\n"};
96  check_exception(config, err_msg);
97 }
std::string string
Definition: nybbler.cc:12
static Config * config
Definition: config.cpp:1054
BOOST_AUTO_TEST_CASE ( nonexistent_path_2  )

Definition at line 99 of file prune_config_t.cc.

100 {
101  std::string const config{"physics.end_paths: [x1, d6]"};
102  std::string const err_msg{
103  "---- Configuration BEGIN\n"
104  " The following error occurred while processing path configurations:\n"
105  " Unknown path x1 has been specified in 'end_paths'.\n"
106  " Unknown path d6 has been specified in 'end_paths'.\n"
107  "---- Configuration END\n"};
108  check_exception(config, err_msg);
109 }
std::string string
Definition: nybbler.cc:12
static Config * config
Definition: config.cpp:1054
BOOST_AUTO_TEST_CASE ( unconfigured_label  )

Definition at line 111 of file prune_config_t.cc.

112 {
113  std::string const config{"process_name: \"test\" "
114  "physics: { "
115  " p1: [ \"-f\", p, a ] "
116  "}"};
117  std::string const err_msg{
118  "---- Configuration BEGIN\n"
119  " The following error occurred while processing a path "
120  "configuration:\n"
121  " Entry with name f in path p1 does not have a module configuration.\n"
122  "---- Configuration END\n"};
123  check_exception(config, err_msg);
124 }
std::string string
Definition: nybbler.cc:12
static Config * config
Definition: config.cpp:1054
BOOST_AUTO_TEST_CASE ( illegal_label  )

Definition at line 126 of file prune_config_t.cc.

127 {
128  std::string const config{"process_name: \"test\" "
129  "physics: {"
130  " p1: [ \"!f-g\" ]"
131  "}"};
132  std::string const err_msg{
133  "---- Configuration BEGIN\n"
134  " There was an error parsing the entry \"!f-g\"in a FHiCL sequence.\n"
135  " The '!' or '-' character may appear as only the first character in the "
136  "path entry.\n"
137  "---- Configuration END\n"};
138  check_exception(config, err_msg);
139 }
std::string string
Definition: nybbler.cc:12
static Config * config
Definition: config.cpp:1054
BOOST_AUTO_TEST_CASE ( illegal_action_for_non_filter  )

Definition at line 141 of file prune_config_t.cc.

142 {
143  std::string const config{"process_name: \"test\" "
144  "physics: {"
145  " producers: { p: {} }"
146  " p1: [ \"!p\" ]"
147  "}"};
148  std::string const err_msg{"---- Configuration BEGIN\n"
149  " The following error occurred while "
150  "processing a path configuration:\n"
151  " Entry with name p in path p1 is a producer and "
152  "cannot have a '!' or '-' prefix.\n"
153  "---- Configuration END\n"};
154  check_exception(config, err_msg);
155 }
std::string string
Definition: nybbler.cc:12
static Config * config
Definition: config.cpp:1054
BOOST_AUTO_TEST_CASE ( unconfigured_label_with_trigger_paths  )

Definition at line 157 of file prune_config_t.cc.

158 {
159  std::string const config{"process_name: \"test\" "
160  "physics: { "
161  " p1: [ f ] "
162  " trigger_paths: [ p1 ] "
163  "}"};
164  std::string const err_msg{
165  "---- Configuration BEGIN\n"
166  " The following error occurred while processing a path "
167  "configuration:\n"
168  " Entry with name f in path p1 does not have a module configuration.\n"
169  "---- Configuration END\n"};
170  check_exception(config, err_msg);
171 }
std::string string
Definition: nybbler.cc:12
static Config * config
Definition: config.cpp:1054
BOOST_AUTO_TEST_CASE ( misspecified_end_path  )

Definition at line 173 of file prune_config_t.cc.

174 {
175  // Incorrectly included end path as trigger path
176  std::string const config{"process_name: MisspecifiedEndPath\n"
177  "physics.analyzers.a1: {\n"
178  " module_type: DummyAnalyzer\n"
179  "}\n"
180  "physics.e1: [a1]\n"
181  "physics.trigger_paths: [e1]\n"};
182  std::string const err_msg{
183  "---- Configuration BEGIN\n"
184  " The following error occurred while processing a path "
185  "configuration:\n"
186  " The 'trigger_paths' override parameter contains the path e1, which has "
187  "an\n"
188  " analyzer with the name a1.\n"
189  " \n"
190  " Path e1 should instead be included as part of the 'end_paths' "
191  "parameter.\n"
192  " Contact artists@fnal.gov for guidance.\n"
193  "---- Configuration END\n"};
194  check_exception(config, err_msg);
195 }
std::string string
Definition: nybbler.cc:12
static Config * config
Definition: config.cpp:1054
BOOST_AUTO_TEST_CASE ( misspecified_trigger_path  )

Definition at line 197 of file prune_config_t.cc.

198 {
199  // Incorrectly included trigger path as end path
200  std::string const config{"process_name: MisspecifiedTriggerPath\n"
201  "physics.producers.d1: {\n"
202  " module_type: DummyProducer\n"
203  "}\n"
204  "physics.p1: [d1]\n"
205  "physics.end_paths: [p1]\n"};
206  std::string const err_msg{
207  "---- Configuration BEGIN\n"
208  " The following error occurred while processing a path "
209  "configuration:\n"
210  " The 'end_paths' override parameter contains the path p1, which has a\n"
211  " producer with the name d1.\n"
212  " \n"
213  " Path p1 should instead be included as part of the 'trigger_paths' "
214  "parameter.\n"
215  " Contact artists@fnal.gov for guidance.\n"
216  "---- Configuration END\n"};
217  check_exception(config, err_msg);
218 }
std::string string
Definition: nybbler.cc:12
static Config * config
Definition: config.cpp:1054
BOOST_AUTO_TEST_CASE ( unsupported_physics_parameters  )

Definition at line 220 of file prune_config_t.cc.

221 {
222  // Incorrectly included parameter in "physics" block
223  std::string const config{"process_name: pathMisspecification "
224  "physics: { "
225  " producers : {} "
226  " filters : {} "
227  " analyzers : {} "
228  " test : atom "
229  " check : { "
230  " cannot : put "
231  " random : table } }"};
232  std::string const err_msg{
233  "---- Configuration BEGIN\n"
234  " \n"
235  " You have specified the following unsupported parameters in the\n"
236  " \"physics\" block of your configuration:\n"
237  " \n"
238  " \"physics.check\" (table)\n"
239  " \"physics.test\" (atom)\n"
240  " \n"
241  " Supported parameters include the following tables:\n"
242  " \"physics.producers\"\n"
243  " \"physics.filters\"\n"
244  " \"physics.analyzers\"\n"
245  " and sequences. Atomic configuration parameters are not allowed.\n"
246  " \n"
247  "---- Configuration END\n"};
248  check_exception(config, err_msg);
249 }
std::string string
Definition: nybbler.cc:12
static Config * config
Definition: config.cpp:1054