Defines

test_tools.h File Reference


Detailed Description

#include <iostream>
#include <stdlib.h>

Defines

#define check(rc, msg)
 If rc is fail, writes an error message and exits.

Define Documentation

#define check (   rc,
  msg 
)
Value:
if(!(rc)) { \
    std::cerr << __FILE__ ":" << __LINE__ << ": error: " << msg << std::endl; \
    abort(); \
  } else { } \

If rc is fail, writes an error message and exits. The error message contains the file name and the line number of the source code in a standard from, which makes it possible to go there using good source browsers like e.g. emacs.

For example

 check(0==1,"This is obviously false.");

will print something like this (and then exits).

file_name.cc:123: error: This is obviously false. 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines