|
Boost-Commit : |
From: nielsdekker_at_[hidden]
Date: 2007-11-24 06:51:03
Author: niels_dekker
Date: 2007-11-24 06:51:03 EST (Sat, 24 Nov 2007)
New Revision: 41326
URL: http://svn.boost.org/trac/boost/changeset/41326
Log:
Checked the result of value_init test function, hoping to pinpoint exactly for what particular type T value_initialized<T> might fail, on some platforms
Text files modified:
trunk/libs/utility/value_init_test.cpp | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
Modified: trunk/libs/utility/value_init_test.cpp
==============================================================================
--- trunk/libs/utility/value_init_test.cpp (original)
+++ trunk/libs/utility/value_init_test.cpp 2007-11-24 06:51:03 EST (Sat, 24 Nov 2007)
@@ -74,9 +74,15 @@
{ return lhs.f == rhs.f && lhs.c == rhs.c && lhs.i == rhs.i ; }
+//
+// This test function tests boost::value_initialized<T> for a specific type T.
+// The first argument (y) is assumed have the value of a value-initialized object.
+// Returns true on success.
+//
template<class T>
-void test ( T const& y, T const& z )
+bool test ( T const& y, T const& z )
{
+ const boost::unit_test::counter_t counter_before_test = boost::minimal_test::errors_counter();
boost::value_initialized<T> x ;
BOOST_CHECK ( y == x ) ;
BOOST_CHECK ( y == boost::get(x) ) ;
@@ -100,21 +106,22 @@
BOOST_CHECK ( y == cx_c ) ;
BOOST_CHECK ( y == boost::get(cx_c) ) ;
#endif
+ return boost::minimal_test::errors_counter() == counter_before_test ;
}
int test_main(int, char **)
{
- test( 0,1234 ) ;
- test( 0.0,12.34 ) ;
- test( POD(0,0,0.0), POD('a',1234,56.78) ) ;
- test( NonPOD( std::string() ), NonPOD( std::string("something") ) ) ;
+ BOOST_CHECK ( test( 0,1234 ) ) ;
+ BOOST_CHECK ( test( 0.0,12.34 ) ) ;
+ BOOST_CHECK ( test( POD(0,0,0.0), POD('a',1234,56.78) ) ) ;
+ BOOST_CHECK ( test( NonPOD( std::string() ), NonPOD( std::string("something") ) ) ) ;
NonPOD NonPOD_object( std::string("NonPOD_object") );
- test<NonPOD *>( 0, &NonPOD_object ) ;
+ BOOST_CHECK ( test<NonPOD *>( 0, &NonPOD_object ) ) ;
AggregatePODStruct zeroInitializedAggregatePODStruct = { 0.0f, '\0', 0 };
AggregatePODStruct nonZeroInitializedAggregatePODStruct = { 1.25f, 'a', -1 };
- test(zeroInitializedAggregatePODStruct, nonZeroInitializedAggregatePODStruct);
+ BOOST_CHECK ( test(zeroInitializedAggregatePODStruct, nonZeroInitializedAggregatePODStruct) );
return 0;
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk