Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JEquals.cc File Reference

Example program to test JLANG::JComparible class. More...

#include <iostream>
#include <iomanip>
#include "JLang/JEquals.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Macros

#define PRINT(OUT, OP, A, B)
 Print.
 

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to test JLANG::JComparible class.

Author
mdejong

Definition in file JEquals.cc.

Macro Definition Documentation

◆ PRINT

#define PRINT ( OUT,
OP,
A,
B )
Value:
OUT << "(" << A << ") " << #OP " (" << B << ") => " << (A OP B) << std::endl;

Print.

Parameters
OUToutput stream
OPoperator
Afirst object
Bsecond object

Definition at line 70 of file JEquals.cc.

70#define PRINT(OUT,OP,A,B) \
71 OUT << "(" << A << ") " << #OP " (" << B << ") => " << (A OP B) << std::endl;

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 80 of file JEquals.cc.

81{
82 using namespace std;
83 using namespace JPP;
84
85 int debug;
86
87 try {
88
89 JParser<> zap("Example program to test object comparisons.");
90
91 zap['d'] = make_field(debug) = 3;
92
93 zap(argc, argv);
94 }
95 catch(const exception &error) {
96 FATAL(error.what() << endl);
97 }
98
99 __A__ a1(0);
100 __A__ a2(1);
101
102 PRINT(cout, ==, a1, a2);
103 PRINT(cout, !=, a1, a2);
104
105 __B__ b1(0);
106 __B__ b2(1);
107
108 PRINT(cout, ==, b1, b1);
109 PRINT(cout, !=, b1, b2);
110 PRINT(cout, ==, b1, 1);
111 PRINT(cout, !=, b1, 1);
112
113 ASSERT(a1 == a1);
114 ASSERT(a1 != a2);
115
116 ASSERT(b1 == b1);
117 ASSERT(b1 != b2);
118 ASSERT(b1 == 0);
119 ASSERT(b1 != 1);
120
121 return 0;
122}
#define PRINT(OUT, OP, A, B)
Print.
Definition JEquals.cc:70
#define ASSERT(A,...)
Assert macro.
Definition JMessage.hh:90
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Utility class to parse command line options.
Definition JParser.hh:1698
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).