9 #include "TestUtils/NameSelector.h" 15 #define BOOST_TEST_MODULE ( NameSelector_test ) 17 #include <boost/test/test_tools.hpp> 57 BOOST_TEST_MESSAGE(
"Testing '" <<
name <<
"'");
64 else if (
name.
find(
"reject") == 0U) {
67 BOOST_CHECK(!selector(
name));
74 BOOST_CHECK(selector(
name));
95 selector.
ParseNames(
"accept_one",
"+accept_two");
108 "accept_one",
"accept_two",
"reject_three",
"accept_unknown" 130 std::cout <<
"MissingQuery" <<
std::endl;
152 std::cout <<
"DefaultConstructorTest" <<
std::endl;
163 CheckNames(selector, {
"accept_one",
"accept_two" });
179 std::cout <<
"DefaultThrowTest" <<
std::endl;
180 selector.
ParseNames(
"accept_one",
"-reject_three");
185 CheckNames(selector, {
"accept_one",
"reject_three",
"throw_two" });
201 std::cout <<
"DefaultRejectTest" <<
std::endl;
202 selector.
ParseNames(
"accept_one",
"-reject_three");
207 CheckNames(selector, {
"accept_one",
"reject_two",
"reject_unknown" });
223 std::cout <<
"DefaultAcceptTest" <<
std::endl;
224 selector.
ParseNames(
"accept_one",
"-reject_three");
229 CheckNames(selector, {
"accept_one",
"accept_two",
"accept_unknown" });
244 (
"set1",
"accept_set1_one",
"+accept_set1_two",
"-reject_set1_three");
246 (
"set2",
"-accept_set2_one",
"-accept_set2_two",
"+reject_set2_three");
247 selector.
Define(
"set3", std::vector<std::string>
248 {
"accept_set3_one",
"+accept_set3_two",
"-reject_set3_three" }
254 std::cout <<
"SetDefinitionTest" <<
std::endl;
255 selector.
ParseNames(
"accept_one",
"set1",
"-@set2",
"+set3",
"-reject_two");
267 "accept_set1_one",
"accept_set1_two",
"reject_set1_three",
268 "accept_set2_one",
"accept_set2_two",
"reject_set2_three",
269 "accept_one",
"reject_two",
"accept_unknown" 285 "accept_one",
"-accept_two",
"+reject_three" 291 std::cout <<
"OverrideTest" <<
std::endl;
292 selector.
ParseNames(
"+reject_three",
"-default",
"accept_one",
"accept_four");
304 "accept_one",
"accept_two",
"reject_three",
"accept_four" 320 "accept_one",
"-accept_two",
"+reject_three" 326 std::cout <<
"GlobalSpecTest" <<
std::endl;
327 selector.
ParseNames(
"accept_one",
"-*",
"-reject_three",
"accept_four");
339 "accept_one",
"reject_unknown",
"reject_three",
"accept_four" 356 std::cout <<
"ClearAllTest" <<
std::endl;
357 selector.
ParseNames(
"throw_lost",
"!",
"-reject_three",
"accept_four");
369 "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)