alpar@574: #ifndef HUGO_TEST_TEST_TOOLS_H alpar@574: #define HUGO_TEST_TEST_TOOLS_H alpar@574: alpar@574: //! \ingroup misc alpar@574: //! \file alpar@574: //! \brief Some utility to write test programs. alpar@574: alpar@574: alpar@574: #include alpar@574: #include alpar@574: alpar@574: //If \c rc is fail, writes an error message end exit. alpar@574: alpar@574: ///If \c rc is fail, writes an error message end exit. alpar@574: ///The error message contains the file name and the line number of the alpar@574: ///source code is a standard from, which makes it possible to go there alpar@574: ///using good source browsers like e.g. \c emacs. alpar@574: /// alpar@574: ///For example alpar@574: ///\code check(0==1,"This is obviously false.");\endcode will alpar@574: ///print this (and then exits). alpar@574: ///\verbatim graph_test.cc:123: error: This is obviously false. \endverbatim alpar@574: #define check(rc, msg) \ alpar@574: if(!(rc)) { \ alpar@574: std::cerr << __FILE__ ":" << __LINE__ << ": error: " << msg << std::endl; \ alpar@574: exit(1); \ alpar@574: } else { } \ alpar@574: alpar@574: ///Structure returned by \ref addPetersen(). alpar@574: alpar@574: ///Structure returned by \ref addPetersen(). alpar@574: /// alpar@574: template struct PetStruct alpar@574: { alpar@574: ///. alpar@574: std::vector outer, inner; alpar@574: ///. alpar@574: std::vector outcir, incir, chords; alpar@574: }; alpar@574: alpar@574: ///Adds a Petersen graph to \c G. alpar@574: alpar@574: ///Adds a Petersen graph to \c G. alpar@574: ///The nodes end edges will be listed in the return structure. alpar@574: template PetStruct addPetersen(Graph &G,int num=5) alpar@574: { alpar@574: PetStruct n; alpar@574: alpar@574: for(int i=0;i