1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/test/predicate_result.hpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,113 @@
1.4 +// (C) Copyright Gennadiy Rozental 2001-2005.
1.5 +// Distributed under the Boost Software License, Version 1.0.
1.6 +// (See accompanying file LICENSE_1_0.txt or copy at
1.7 +// http://www.boost.org/LICENSE_1_0.txt)
1.8 +
1.9 +// See http://www.boost.org/libs/test for the library home page.
1.10 +//
1.11 +// File : $RCSfile: predicate_result.hpp,v $
1.12 +//
1.13 +// Version : $Revision: 1.7 $
1.14 +//
1.15 +// Description : enhanced result for test predicate that include message explaining failure
1.16 +// ***************************************************************************
1.17 +
1.18 +#ifndef BOOST_TEST_PREDICATE_RESULT_HPP_012705GER
1.19 +#define BOOST_TEST_PREDICATE_RESULT_HPP_012705GER
1.20 +
1.21 +// Boost.Test
1.22 +#include <boost/test/utils/class_properties.hpp>
1.23 +#include <boost/test/utils/wrap_stringstream.hpp>
1.24 +#include <boost/test/utils/basic_cstring/basic_cstring.hpp>
1.25 +
1.26 +// Boost
1.27 +#include <boost/shared_ptr.hpp>
1.28 +#include <boost/detail/workaround.hpp>
1.29 +
1.30 +// STL
1.31 +#include <cstddef> // for std::size_t
1.32 +
1.33 +#include <boost/test/detail/suppress_warnings.hpp>
1.34 +
1.35 +//____________________________________________________________________________//
1.36 +
1.37 +namespace boost {
1.38 +
1.39 +namespace test_tools {
1.40 +
1.41 +// ************************************************************************** //
1.42 +// ************** predicate_result ************** //
1.43 +// ************************************************************************** //
1.44 +
1.45 +class BOOST_TEST_DECL predicate_result {
1.46 + typedef unit_test::const_string const_string;
1.47 +public:
1.48 + // Constructor
1.49 + predicate_result( bool pv_ )
1.50 + : p_predicate_value( pv_ )
1.51 + {}
1.52 +
1.53 + template<typename BoolConvertable>
1.54 + predicate_result( BoolConvertable const& pv_ ) : p_predicate_value( !!pv_ ) {}
1.55 +
1.56 + bool operator!() const { return !p_predicate_value; }
1.57 + void operator=( bool pv_ ) { p_predicate_value.value = pv_; }
1.58 +
1.59 + // Public properties
1.60 + BOOST_READONLY_PROPERTY( bool, (predicate_result) ) p_predicate_value;
1.61 +
1.62 + // Access methods
1.63 + bool has_empty_message() const { return !m_message; }
1.64 + wrap_stringstream& message()
1.65 + {
1.66 + if( !m_message )
1.67 + m_message.reset( new wrap_stringstream );
1.68 +
1.69 + return *m_message;
1.70 + }
1.71 + const_string message() const { return !m_message ? const_string() : const_string( m_message->str() ); }
1.72 +
1.73 +private:
1.74 + // Data members
1.75 + shared_ptr<wrap_stringstream> m_message;
1.76 +};
1.77 +
1.78 +} // namespace test_tools
1.79 +
1.80 +} // namespace boost
1.81 +
1.82 +//____________________________________________________________________________//
1.83 +
1.84 +#include <boost/test/detail/enable_warnings.hpp>
1.85 +
1.86 +// ***************************************************************************
1.87 +// Revision History :
1.88 +//
1.89 +// $Log: predicate_result.hpp,v $
1.90 +// Revision 1.7 2005/12/14 05:16:49 rogeeff
1.91 +// dll support introduced
1.92 +//
1.93 +// Revision 1.6 2005/03/23 21:02:17 rogeeff
1.94 +// Sunpro CC 5.3 fixes
1.95 +//
1.96 +// Revision 1.5 2005/02/20 08:27:06 rogeeff
1.97 +// This a major update for Boost.Test framework. See release docs for complete list of fixes/updates
1.98 +//
1.99 +// Revision 1.4 2005/02/03 20:39:12 rogeeff
1.100 +// m_message zero init for sunpro
1.101 +//
1.102 +// Revision 1.3 2005/02/01 06:40:06 rogeeff
1.103 +// copyright update
1.104 +// old log entries removed
1.105 +// minor stilistic changes
1.106 +// depricated tools removed
1.107 +//
1.108 +// Revision 1.2 2005/01/31 20:07:19 rogeeff
1.109 +// Sunpro CC 5.3 workarounds
1.110 +//
1.111 +// Revision 1.1 2005/01/30 03:24:51 rogeeff
1.112 +// extended_predicate_result renamed ot predicate_result and moved into separate file
1.113 +//
1.114 +// ***************************************************************************
1.115 +
1.116 +#endif // BOOST_TEST_PREDICATE_RESULT_HPP_012705GER