00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00036 #ifndef HH_SENF_Utils_auto_unit_test_
00037 #define HH_SENF_Utils_auto_unit_test_ 1
00038
00039
00040 #include <iostream>
00041 #include <boost/version.hpp>
00042
00043
00044 #include "auto_unit_test.ih"
00045
00046
00047 #if BOOST_VERSION >= 103400
00048
00049 # define BOOST_AUTO_UNIT_TEST BOOST_AUTO_TEST_CASE
00050
00051 #endif
00052
00053 #include <boost/test/auto_unit_test.hpp>
00054
00084 #define COMPILE_FAIL(n) void n()
00085
00093 #define SENF_CHECK_NO_THROW(expr) \
00094 BOOST_CHECK_NO_THROW( \
00095 try { expr ; } \
00096 catch (std::exception & e) { std::cerr << e.what() << std::endl; throw; } )
00097
00098 namespace senf {
00099 namespace test {
00100
00101 template <class Iterator>
00102 typename detail::NoCharIterator<Iterator>::type nocharIterator(Iterator i);
00103
00104 }}
00105
00116 #define SENF_CHECK_EQUAL_COLLECTIONS(left_begin, left_end, right_begin, right_end) \
00117 BOOST_CHECK_EQUAL_COLLECTIONS( \
00118 senf::test::nocharIterator(left_begin), senf::test::nocharIterator(left_end), \
00119 senf::test::nocharIterator(right_begin), senf::test::nocharIterator(right_end))
00120
00130 #define SENF_AUTO_UNIT_TEST(name) \
00131 void senf_test_body_##name(); \
00132 BOOST_AUTO_UNIT_TEST(name) \
00133 { \
00134 try { \
00135 senf_test_body_##name(); \
00136 } \
00137 catch (std::exception & e) { \
00138 std::cerr << e.what() << std::endl; \
00139 throw; \
00140 } \
00141 } \
00142 void senf_test_body_##name()
00143
00144
00145 #ifdef DOXYGEN
00146
00152 #define SENF_CHECK_NOT_EQUAL( Left, Rigth)
00153 #else
00154 #ifdef BOOST_CHECK_NE
00155 #define SENF_CHECK_NOT_EQUAL( Left, Right) BOOST_CHECK_NE( Left, Right)
00156 #else
00157 #define SENF_CHECK_NOT_EQUAL( Left, Right) BOOST_CHECK( Left != Right)
00158 #endif
00159 #endif
00160
00161
00162
00163
00164 #include "auto_unit_test.cti"
00165 #endif
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176