X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senf%2FUtils%2Fauto_unit_test.hh;h=c7e090add92f1f6070acfd2c53d2aa4006ba9470;hb=941ca33da6ee01d78c07fa6b514de10da1ef3948;hp=c12bb7d90e7c8d41e52fbe306703dfc8408ee5ce;hpb=601d1f509f5bb24df167a4dd5a20da67a0af9af8;p=senf.git diff --git a/senf/Utils/auto_unit_test.hh b/senf/Utils/auto_unit_test.hh index c12bb7d..c7e090a 100644 --- a/senf/Utils/auto_unit_test.hh +++ b/senf/Utils/auto_unit_test.hh @@ -41,6 +41,7 @@ #include //#include "auto_unit_test.mpp" +#include "auto_unit_test.ih" ///////////////////////////////hh.p//////////////////////////////////////// #if BOOST_VERSION >= 103400 @@ -89,15 +90,61 @@ \ingroup unittest */ -#define SENF_CHECK_NO_THROW(expr) \ - BOOST_CHECK_NO_THROW( \ - try { expr ; } \ +#define SENF_CHECK_NO_THROW(expr) \ + BOOST_CHECK_NO_THROW( \ + try { expr ; } \ catch (std::exception & e) { std::cerr << e.what() << std::endl; throw; } ) +namespace senf { +namespace test { + + template + typename detail::NoCharIterator::type nocharIterator(Iterator i); + +}} + +/** \brief Check ranges for equality, writing char's as int's + + \ref SENF_CHECK_EQUAL_COLLECTIONS() is like \c BOOST_CHECK_EQUAL_COLLECTIONS(). The only + difference is, that \ref SENF_CHECK_EQUAL_COLLECTIONS() will write out collection values in + numeric form (and not as single characters) if the elements are of any char type. Other types + are not affected. + + \hideinitializer + \ingroup unittest + */ +#define SENF_CHECK_EQUAL_COLLECTIONS(left_begin, left_end, right_begin, right_end) \ + BOOST_CHECK_EQUAL_COLLECTIONS( \ + senf::test::nocharIterator(left_begin), senf::test::nocharIterator(left_end), \ + senf::test::nocharIterator(right_begin), senf::test::nocharIterator(right_end)) + +/** \brief Define new test case + + \ref SENF_AUTO_UNIT_TEST() is like \c BOOST_AUTO_UNIT_TEST(). The only difference is, that + if an exception is thrown in the test case \ref SENF_AUTO_UNIT_TEST() will write out the + complete what-message of the exception. + + \hideinitializer + \ingroup unittest + */ +#define SENF_AUTO_UNIT_TEST(name) \ + void senf_test_body_##name(); \ + BOOST_AUTO_UNIT_TEST(name) \ + { \ + try { \ + senf_test_body_##name(); \ + } \ + catch (std::exception & e) { \ + std::cerr << e.what() << std::endl; \ + throw; \ + } \ + } \ + void senf_test_body_##name() + ///////////////////////////////hh.e//////////////////////////////////////// //#include "auto_unit_test.cci" //#include "auto_unit_test.ct" -//#include "auto_unit_test.cti" +#include "auto_unit_test.cti" #endif