Jpp  17.3.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Macros | Functions
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)   OUT << "(" << A << ") " << #OP " (" << B << ") => " << (A OP B) << std::endl;
 Print. More...
 

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

#define PRINT (   OUT,
  OP,
  A,
 
)    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.

Function Documentation

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 }
Utility class to parse command line options.
Definition: JParser.hh:1517
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1993
#define FATAL(A)
Definition: JMessage.hh:67
#define PRINT(OUT, OP, A, B)
Print.
Definition: JEquals.cc:70
int debug
debug level