/usr/include/boost/test/exception_safety.hpp is in libboost1.55-dev 1.55.0+dfsg-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | // (C) Copyright Gennadiy Rozental 2005-2008.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
// File : $RCSfile$
//
// Version : $Revision: 49312 $
//
// Description : Facilities to perform exception safety tests
// ***************************************************************************
#ifndef BOOST_TEST_EXCEPTION_SAFETY_HPP_111705GER
#define BOOST_TEST_EXCEPTION_SAFETY_HPP_111705GER
// Boost.Test
#include <boost/test/detail/config.hpp>
#include <boost/test/utils/callback.hpp>
#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
// STL
#include <memory>
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
// ************************************************************************** //
// ************** BOOST_TEST_EXCEPTION_SAFETY ************** //
// ************************************************************************** //
#define BOOST_TEST_EXCEPTION_SAFETY( test_name ) \
struct test_name : public BOOST_AUTO_TEST_CASE_FIXTURE \
{ void test_method(); }; \
\
static void BOOST_AUTO_TC_INVOKER( test_name )() \
{ \
test_name t; \
::boost::itest::exception_safety( \
boost::bind( &test_name::test_method, t ), \
BOOST_STRINGIZE(test_name) ); \
} \
\
struct BOOST_AUTO_TC_UNIQUE_ID( test_name ) {}; \
\
BOOST_AUTO_TU_REGISTRAR( test_name )( \
boost::unit_test::make_test_case( \
&BOOST_AUTO_TC_INVOKER( test_name ), #test_name ), \
boost::unit_test::ut_detail::auto_tc_exp_fail< \
BOOST_AUTO_TC_UNIQUE_ID( test_name )>::instance()->value() ); \
\
void test_name::test_method() \
/**/
namespace boost {
namespace itest {
// ************************************************************************** //
// ************** exception safety test ************** //
// ************************************************************************** //
void BOOST_TEST_DECL exception_safety( unit_test::callback0<> const& F,
unit_test::const_string test_name = "" );
} // namespace itest
} // namespace boost
// ************************************************************************** //
// ************** global operator new/delete overloads ************** //
// ************************************************************************** //
#ifndef BOOST_ITEST_NO_NEW_OVERLOADS
#include <boost/test/interaction_based.hpp>
# ifdef BOOST_NO_STDC_NAMESPACE
namespace std { using ::isprint; using ::malloc; using ::free; }
# endif
inline void*
operator new( std::size_t s ) throw(std::bad_alloc)
{
void* res = std::malloc(s ? s : 1);
if( res )
::boost::itest::manager::instance().allocated( 0, 0, res, s );
else
throw std::bad_alloc();
return res;
}
//____________________________________________________________________________//
inline void*
operator new( std::size_t s, std::nothrow_t const& ) throw()
{
void* res = std::malloc(s ? s : 1);
if( res )
::boost::itest::manager::instance().allocated( 0, 0, res, s );
return res;
}
//____________________________________________________________________________//
inline void*
operator new[]( std::size_t s ) throw(std::bad_alloc)
{
void* res = std::malloc(s ? s : 1);
if( res )
::boost::itest::manager::instance().allocated( 0, 0, res, s );
else
throw std::bad_alloc();
return res;
}
//____________________________________________________________________________//
inline void*
operator new[]( std::size_t s, std::nothrow_t const& ) throw()
{
void* res = std::malloc(s ? s : 1);
if( res )
::boost::itest::manager::instance().allocated( 0, 0, res, s );
return res;
}
//____________________________________________________________________________//
inline void
operator delete( void* p ) throw()
{
::boost::itest::manager::instance().freed( p );
std::free( p );
}
//____________________________________________________________________________//
inline void
operator delete( void* p, std::nothrow_t const& ) throw()
{
::boost::itest::manager::instance().freed( p );
std::free( p );
}
//____________________________________________________________________________//
inline void
operator delete[]( void* p ) throw()
{
::boost::itest::manager::instance().freed( p );
std::free( p );
}
//____________________________________________________________________________//
inline void
operator delete[]( void* p, std::nothrow_t const& ) throw()
{
::boost::itest::manager::instance().freed( p );
std::free( p );
}
//____________________________________________________________________________//
#endif // BOOST_ITEST_NO_NEW_OVERLOADS
//____________________________________________________________________________//
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_EXCEPTION_SAFETY_HPP_111705GER
|