57{
60
62
63 try {
64
65 JParser<> zap(
"Auxiliary program to test object selection methods.");
66
68
69 zap(argc, argv);
70 }
71 catch(const exception &error) {
72 FATAL(error.what() << endl);
73 }
74
76
77 buffer.push_back(__A__(3));
78 buffer.push_back(__A__(4));
79 buffer.push_back(__A__(2));
80 buffer.push_back(__A__(1));
81 buffer.push_back(__A__(5));
82
83
84 print(cout,
debug,
"data:", buffer.begin(), buffer.end());
85
87
88 {
89 vector<__A__>::const_iterator p = find_if(buffer.begin(), buffer.end(), make_predicate(&__A__::a, x));
90
91 DEBUG(
"has " << x <<
"? " << (p != buffer.end() ?
"yes" :
"no") << endl);
92
93 ASSERT(p != buffer.end() && p->a == x);
94 }
95
96 {
97 vector<__A__>::const_iterator p = find_if(buffer.begin(), buffer.end(), make_predicate(&__A__::get, x));
98
99 DEBUG(
"has " << x <<
"? " << (p != buffer.end() ?
"yes" :
"no") << endl);
100
101 ASSERT(p != buffer.end() && p->get() == x);
102 }
103
104 {
106
107 print(cout,
debug,
"selection:", buffer.begin(), p);
108
111 }
112 }
113
114 {
115 ASSERT(count_if(buffer.begin(), buffer.end(), make_predicate(&__A__::a, 1,
JComparison::eq())) == 1);
116 ASSERT(count_if(buffer.begin(), buffer.end(), make_predicate(&__A__::a, 2,
JComparison::gt())) == 3);
117 }
118
119 return 0;
120}
#define DEBUG(A)
Message macros.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
void print(const TH1 &h1, std::ostream &out)
Print histogram parameters.
Utility class to parse command line options.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).