Added value_init test for an value_initialized<T> object allocated on the heap.

[SVN r41667]
This commit is contained in:
Niels Dekker 2007-12-03 21:41:59 +00:00
parent e1a63495b6
commit a470b591fb

View File

@ -13,6 +13,7 @@
#include <string> #include <string>
#include "boost/utility/value_init.hpp" #include "boost/utility/value_init.hpp"
#include <boost/shared_ptr.hpp>
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop
@ -178,6 +179,9 @@ bool test ( T const& y, T const& z )
x_c_ref = z ; x_c_ref = z ;
BOOST_CHECK ( x_c == z ) ; BOOST_CHECK ( x_c == z ) ;
boost::shared_ptr<boost::value_initialized<T> > ptr( new boost::value_initialized<T> );
BOOST_CHECK ( y == *ptr ) ;
#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) #if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)
boost::value_initialized<T const> cx ; boost::value_initialized<T const> cx ;
BOOST_CHECK ( y == cx ) ; BOOST_CHECK ( y == cx ) ;
@ -187,6 +191,7 @@ bool test ( T const& y, T const& z )
BOOST_CHECK ( y == cx_c ) ; BOOST_CHECK ( y == cx_c ) ;
BOOST_CHECK ( y == boost::get(cx_c) ) ; BOOST_CHECK ( y == boost::get(cx_c) ) ;
#endif #endif
return boost::minimal_test::errors_counter() == counter_before_test ; return boost::minimal_test::errors_counter() == counter_before_test ;
} }