X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Utils%2Fauto_unit_test.hh;h=c12bb7d90e7c8d41e52fbe306703dfc8408ee5ce;hb=fd3a0e8ac95d1158e9ea661ddf9187b67c70169f;hp=70487e3d1b7133e5156d4e71a045bc62c41afdbf;hpb=f37ed4b85a6949cbe72ccb2d2ac098aebed57eaa;p=senf.git diff --git a/Utils/auto_unit_test.hh b/Utils/auto_unit_test.hh index 70487e3..c12bb7d 100644 --- a/Utils/auto_unit_test.hh +++ b/Utils/auto_unit_test.hh @@ -33,10 +33,11 @@ (with possibliy adjusted path). */ -#ifndef HH_auto_unit_test_ -#define HH_auto_unit_test_ 1 +#ifndef HH_SENF_Utils_auto_unit_test_ +#define HH_SENF_Utils_auto_unit_test_ 1 // Custom includes +#include #include //#include "auto_unit_test.mpp" @@ -50,6 +51,49 @@ #include +/** \defgroup unittest Boost.Test extensions + + This module defines some additional extensions to Boost.Test + */ + +/** \brief Check for compile failure + + COMPILE_FAIL() 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 { expr ; } \ + catch (std::exception & e) { std::cerr << e.what() << std::endl; throw; } ) + ///////////////////////////////hh.e//////////////////////////////////////// //#include "auto_unit_test.cci" //#include "auto_unit_test.ct"