g4tools  5.4.0
cmp
Go to the documentation of this file.
1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
2 // See the file tools.license for terms.
3 
4 #ifndef tools_cmp
5 #define tools_cmp
6 
7 #include <ostream>
8 
9 namespace tools {
10 
11 template <class T>
12 inline bool cmp(std::ostream& a_out,
13  const T& a_what,
14  const T& a_ref,const T& a_error = T()) {
15  if(a_what>a_ref) {
16  if((a_what-a_ref)>a_error) {
17  a_out << a_ref << " expected. Got " << a_what << std::endl;
18  return false;
19  }
20  } else {
21  if((a_ref-a_what)>a_error) {
22  a_out << a_ref << " expected. Got " << a_what << std::endl;
23  return false;
24  }
25  }
26  return true;
27 }
28 
29 }
30 
31 #endif
tools::cmp
bool cmp(std::ostream &a_out, const T &a_what, const T &a_ref, const T &a_error=T())
Definition: cmp:12
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26