29 friend inline std::ostream&
operator<<(std::ostream& out,
const __A__&
object) {
return out <<
object.a; }
36 void print(std::ostream& out,
int debug,
const char* title, T __begin, T __end)
43 copy(__begin, __end, ostream_iterator<typename T::value_type>(out,
" "));
56 int main(
int argc,
char **argv)
65 JParser<> zap(
"Auxiliary program to test object comparison methods.");
71 catch(
const exception &error) {
72 FATAL(error.what() << endl);
79 buffer.push_back(__A__(3.0));
80 buffer.push_back(__A__(4.0));
81 buffer.push_back(__A__(2.0));
82 buffer.push_back(__A__(1.0));
83 buffer.push_back(__A__(5.0));
85 ASSERT(buffer.size() >= 2);
89 buffer.begin(), buffer.end());
95 "sort(.., make_comparator(&__A__::get))",
96 buffer.begin(), buffer.end());
98 for (buffer_type::const_iterator q = buffer.begin(), p = q++; q != buffer.end(); ++p, ++q) {
99 ASSERT(p->get() < q->get(),
"test sort");
104 for (
const auto& i : buffer) {
106 buffer_type::const_iterator p = lower_bound(buffer.begin(), buffer.end(), i.get(),
make_comparator(&__A__::get));
108 ASSERT(p != buffer.end() && i.get() == p->get(),
"test lower_bound");
115 "sort(.., make_comparator(&__A__::get, JComparison::gt()))",
116 buffer.begin(), buffer.end());
118 for (buffer_type::const_iterator q = buffer.begin(), p = q++; q != buffer.end(); ++p, ++q) {
119 ASSERT(p->get() > q->get());
126 "sort(.., make_comparator(&__A__::a))",
127 buffer.begin(), buffer.end());
129 for (buffer_type::const_iterator q = buffer.begin(), p = q++; q != buffer.end(); ++p, ++q) {
136 "sort(.., make_comparator(&__A__::a), JComparison::gt())",
137 buffer.begin(), buffer.end());
139 for (buffer_type::const_iterator q = buffer.begin(), p = q++; q != buffer.end(); ++p, ++q) {
int main(int argc, char **argv)
General purpose messaging.
#define ASSERT(A,...)
Assert macro.
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Utility class to parse command line options.
void copy(const Head &from, JHead &to)
Copy header from from to to.
std::ostream & print(std::ostream &out, const JTestSummary &summary, const char delimiter=' ', const bool useColors=true)
Print test summary.
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
std::vector< JHitW0 > buffer_type
hits