alpar@4: /* -*- C++ -*- alpar@4: * alpar@4: * This file is a part of LEMON, a generic C++ optimization library alpar@4: * alpar@39: * Copyright (C) 2003-2008 alpar@4: * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport alpar@4: * (Egervary Research Group on Combinatorial Optimization, EGRES). alpar@4: * alpar@4: * Permission to use, modify and distribute this software is granted alpar@4: * provided that this copyright notice appears in all copies. For alpar@4: * precise terms see the accompanying LICENSE file. alpar@4: * alpar@4: * This software is provided "AS IS" with no warranty of any kind, alpar@4: * express or implied, and with no claim as to its suitability for any alpar@4: * purpose. alpar@4: * alpar@4: */ alpar@4: alpar@4: #ifndef LEMON_TEST_TEST_TOOLS_H alpar@4: #define LEMON_TEST_TEST_TOOLS_H alpar@4: alpar@4: #include alpar@4: alpar@4: //! \ingroup misc alpar@4: //! \file alpar@4: //! \brief Some utilities to write test programs. alpar@4: alpar@4: alpar@4: ///If \c rc is fail, writes an error message end exit. alpar@4: alpar@4: ///If \c rc is fail, writes an error message end exit. alpar@4: ///The error message contains the file name and the line number of the alpar@4: ///source code in a standard from, which makes it possible to go there alpar@4: ///using good source browsers like e.g. \c emacs. alpar@4: /// alpar@4: ///For example alpar@4: ///\code check(0==1,"This is obviously false.");\endcode will alpar@4: ///print this (and then exits). alpar@4: ///\verbatim graph_test.cc:123: error: This is obviously false. \endverbatim alpar@4: /// alpar@4: ///\todo It should be in \c error.h alpar@4: #define check(rc, msg) \ alpar@4: if(!(rc)) { \ alpar@4: std::cerr << __FILE__ ":" << __LINE__ << ": error: " << msg << std::endl; \ alpar@4: abort(); \ alpar@4: } else { } \ alpar@4: alpar@4: #endif