inlib  1.2.0
/Users/barrand/private/dev/softinex/old/inexlib-1.2/inlib/inlib/cmp
Go to the documentation of this file.
00001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
00002 // See the file inlib.license for terms.
00003 
00004 #ifndef inlib_cmp
00005 #define inlib_cmp
00006 
00007 #include <ostream>
00008 
00009 namespace inlib {
00010 
00011 template <class T>
00012 inline bool cmp(std::ostream& a_out,
00013                 const T& a_what,
00014                 const T& a_ref,const T& a_error = T()) {
00015   if(a_what>a_ref) {
00016     if((a_what-a_ref)>a_error) {
00017       a_out << a_ref << " expected. Got " << a_what << std::endl;
00018       return false;
00019     }
00020   } else {
00021     if((a_ref-a_what)>a_error) {
00022       a_out << a_ref << " expected. Got " << a_what << std::endl;
00023       return false;
00024     }
00025   }
00026   return true;
00027 }
00028 
00029 }
00030 
00031 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines