X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2Fauto_unit_test.hh;h=b2e60ae5a6ee23536311c7c44092b6c5a3ae90e5;hb=2ae8369efcfae23a1961d13aef0b42d45baed03a;hp=beb770f20b3c84111710ed6afecc34654f275872;hpb=d6abda313f70c8a849c5e3f3bbfc12ce301789f1;p=senf.git diff --git a/Utils/auto_unit_test.hh b/Utils/auto_unit_test.hh index beb770f..b2e60ae 100644 --- a/Utils/auto_unit_test.hh +++ b/Utils/auto_unit_test.hh @@ -1,8 +1,8 @@ // $Id$ // -// Copyright (C) 2007 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer NETwork research (NET) +// Copyright (C) 2007 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund // // This program is free software; you can redistribute it and/or modify @@ -21,7 +21,17 @@ // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /** \file - \brief auto_unit_test public header */ + \brief Boost.Test auto unit test compatibility across Boost V 1.33 and 1.34 + + This header file will allows to consistently use the Boost Version 1.33 syntax for defining auto + unit tests. If the available Boost version is 1.34, this file will automatically take care of + any necessary workarounds. + + So, instead of \#include , you should always write +
+    \#include "../Utils/auto_unit_test.hh"
+    
(with possibliy adjusted path). + */ #ifndef HH_auto_unit_test_ #define HH_auto_unit_test_ 1 @@ -40,6 +50,49 @@ #include +/** \defgroup unittest Boost.Test extensions + + This module defines some additional extensions to Boost.Test + */ + +/** \brief Check for compile failure + + COMPILE_RAIL() is used to check, that a certain piece of code will produce a compile time + failure. + + \code + #ifdef COMPILE_CHECK + + COMPILE_FAIL(foo) + { + // fails to compile .... + int x = "foo"; + } + + COMPILE_FAIL(bar) + { ... } + + #endif + \endcode + + This check is performed by the extended unit-test builder in \c senfscons. + + \ingroup unittest + */ +#define COMPILE_FAIL(n) void n() + +/** \brief Show exception information + + \ref SENF_CHECK_NO_THROW() is an extension to \c BOOST_CHECK_NO_THROW() which will write out the + unabridged exception information when an exception is thrown in addition to signaling an error. + + \ingroup unittest + */ +#define SENF_CHECK_NO_THROW(expr) \ + BOOST_CHECK_NO_THROW( \ + try { (void) expr ; } \ + catch (std::exception & e) { std::cerr << e.what() << std::endl; throw; } ) + ///////////////////////////////hh.e//////////////////////////////////////// //#include "auto_unit_test.cci" //#include "auto_unit_test.ct"