test/test_tools.h
changeset 767 11c946fa8d13
parent 440 88ed40ad0d4f
child 877 141f9c0db4a3
equal deleted inserted replaced
6:a42b5b34dfc4 7:e786eb9ac3e5
    35 ///
    35 ///
    36 ///For example
    36 ///For example
    37 ///\code check(0==1,"This is obviously false.");\endcode will
    37 ///\code check(0==1,"This is obviously false.");\endcode will
    38 ///print something like this (and then exits).
    38 ///print something like this (and then exits).
    39 ///\verbatim file_name.cc:123: error: This is obviously false. \endverbatim
    39 ///\verbatim file_name.cc:123: error: This is obviously false. \endverbatim
    40 #define check(rc, msg) \
    40 #define check(rc, msg)                                                  \
    41   if(!(rc)) { \
    41   {                                                                     \
    42     std::cerr << __FILE__ ":" << __LINE__ << ": error: " << msg << std::endl; \
    42     if(!(rc)) {                                                         \
    43     abort(); \
    43       std::cerr << __FILE__ ":" << __LINE__ << ": error: "              \
    44   } else { } \
    44                 << msg << std::endl;                                    \
       
    45       abort();                                                          \
       
    46     } else { }                                                          \
       
    47   }                                                                     \
       
    48     
    45 
    49 
    46 #endif
    50 #endif