Search:

SENF Extensible Network Framework

  • Home
  • Download
  • Wiki
  • BerliOS
  • ChangeLog
  • Browse SVN
  • Bug Tracker
  • Overview
  • Examples
  • HowTos
  • Glossary
  • PPI
  • Packets
  • Scheduler
  • Socket
  • Utils
  • Console
  • Daemon
  • Logger
  • Termlib
  • Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

auto_unit_test.hh

Go to the documentation of this file.
00001 // $Id: auto_unit_test.hh 1742 2010-11-04 14:51:56Z g0dil $
00002 //
00003 // Copyright (C) 2007
00004 // Fraunhofer (FOKUS)
00005 // Competence Center NETwork research (NET), St. Augustin, GERMANY
00006 //     Stefan Bund <g0dil@berlios.de>
00007 //
00008 // This program is free software; you can redistribute it and/or modify
00009 // it under the terms of the GNU General Public License as published by
00010 // the Free Software Foundation; either version 2 of the License, or
00011 // (at your option) any later version.
00012 //
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU General Public License
00019 // along with this program; if not, write to the
00020 // Free Software Foundation, Inc.,
00021 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00022 
00036 #ifndef HH_SENF_Utils_auto_unit_test_
00037 #define HH_SENF_Utils_auto_unit_test_ 1
00038 
00039 // Custom includes
00040 #include <iostream>
00041 #include <boost/version.hpp>
00042 
00043 //#include "auto_unit_test.mpp"
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 //#include "auto_unit_test.cci"
00163 //#include "auto_unit_test.ct"
00164 #include "auto_unit_test.cti"
00165 #endif
00166 
00167 
00168 // Local Variables:
00169 // mode: c++
00170 // fill-column: 100
00171 // comment-column: 40
00172 // c-file-style: "senf"
00173 // indent-tabs-mode: nil
00174 // ispell-local-dictionary: "american"
00175 // compile-command: "scons -u test"
00176 // End:

Contact: senf-dev@lists.berlios.de | © 2006-2010 Fraunhofer Institute for Open Communication Systems, Network Research