15 #define BOOST_TEST_MODULE ( NameSelector_test ) 16 #include <boost/test/unit_test.hpp> 56 BOOST_TEST_MESSAGE(
"Testing '" <<
name <<
"'");
63 else if (
name.
find(
"reject") == 0U) {
66 BOOST_TEST(!selector(
name));
73 BOOST_TEST(selector(
name));
94 selector.
ParseNames(
"accept_one",
"+accept_two");
107 "accept_one",
"accept_two",
"reject_three",
"accept_unknown" 129 std::cout <<
"MissingQuery" <<
std::endl;
151 std::cout <<
"DefaultConstructorTest" <<
std::endl;
162 CheckNames(selector, {
"accept_one",
"accept_two" });
178 std::cout <<
"DefaultThrowTest" <<
std::endl;
179 selector.
ParseNames(
"accept_one",
"-reject_three");
184 CheckNames(selector, {
"accept_one",
"reject_three",
"throw_two" });
200 std::cout <<
"DefaultRejectTest" <<
std::endl;
201 selector.
ParseNames(
"accept_one",
"-reject_three");
206 CheckNames(selector, {
"accept_one",
"reject_two",
"reject_unknown" });
222 std::cout <<
"DefaultAcceptTest" <<
std::endl;
223 selector.
ParseNames(
"accept_one",
"-reject_three");
228 CheckNames(selector, {
"accept_one",
"accept_two",
"accept_unknown" });
243 (
"set1",
"accept_set1_one",
"+accept_set1_two",
"-reject_set1_three");
245 (
"set2",
"-accept_set2_one",
"-accept_set2_two",
"+reject_set2_three");
246 selector.
Define(
"set3", std::vector<std::string>
247 {
"accept_set3_one",
"+accept_set3_two",
"-reject_set3_three" }
253 std::cout <<
"SetDefinitionTest" <<
std::endl;
254 selector.
ParseNames(
"accept_one",
"set1",
"-@set2",
"+set3",
"-reject_two");
266 "accept_set1_one",
"accept_set1_two",
"reject_set1_three",
267 "accept_set2_one",
"accept_set2_two",
"reject_set2_three",
268 "accept_one",
"reject_two",
"accept_unknown" 284 "accept_one",
"-accept_two",
"+reject_three" 290 std::cout <<
"OverrideTest" <<
std::endl;
291 selector.
ParseNames(
"+reject_three",
"-default",
"accept_one",
"accept_four");
303 "accept_one",
"accept_two",
"reject_three",
"accept_four" 319 "accept_one",
"-accept_two",
"+reject_three" 325 std::cout <<
"GlobalSpecTest" <<
std::endl;
326 selector.
ParseNames(
"accept_one",
"-*",
"-reject_three",
"accept_four");
338 "accept_one",
"reject_unknown",
"reject_three",
"accept_four" 355 std::cout <<
"ClearAllTest" <<
std::endl;
356 selector.
ParseNames(
"throw_lost",
"!",
"-reject_three",
"accept_four");
368 "throw_lost",
"throw_unknown",
"reject_three",
"accept_four"
void Define(std::string set_name, LIST const &items)
Defines a set.
BOOST_AUTO_TEST_CASE(SimpleTest)
void AddToDefinition(std::string set_name, NAMES...names)
Parses a list of names and add them to the specified definition.
bool Accepted(Name_t name) const
Returns whether the name is accepted as good.
void CheckNames(testing::NameSelector const &selector, std::vector< std::string > const &names)
void ParseNames(NAMES...names)
Parses a list of names and adds them to the selector.
void PrintConfiguration(std::ostream &) const
Prints the configuration into a stream.
int find(char c, int index=0, bool cs=TRUE) const
void ParseName(Name_t name)
Parses a name and adds it to the selector.
bool Rejected(Name_t name) const
Returns whether the name is rejected as bad.
bool CheckQueryRegistry() const
Checks that no known element with valid response was left unqueried.
throw art::Exception (art::errors::Configuration)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
static std::vector< std::string > const names
QTextStream & endl(QTextStream &s)
Response_t Query(Name_t name) const
Returns the response for the specified name (does not throw)