Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r61209 - trunk/libs/config/test
From: nielsdekker_at_[hidden]
Date: 2010-04-11 16:33:50


Author: niels_dekker
Date: 2010-04-11 16:33:49 EDT (Sun, 11 Apr 2010)
New Revision: 61209
URL: http://svn.boost.org/trac/boost/changeset/61209

Log:
Added check of an lvalue value_initializer object on the stack.
Text files modified:
   trunk/libs/config/test/boost_no_com_value_init.ipp | 33 +++++++++++++++++++++++++++------
   1 files changed, 27 insertions(+), 6 deletions(-)

Modified: trunk/libs/config/test/boost_no_com_value_init.ipp
==============================================================================
--- trunk/libs/config/test/boost_no_com_value_init.ipp (original)
+++ trunk/libs/config/test/boost_no_com_value_init.ipp 2010-04-11 16:33:49 EDT (Sun, 11 Apr 2010)
@@ -538,17 +538,38 @@
 
   int test()
   {
+ // Check value-initialization of a temporary object, an object on the stack,
+ // and one on the heap:
     dirty_stack();
- // Check both value-initialization on the stack and on the heap:
- const unsigned num_failures_on_stack = value_initializer().check();
+ const unsigned num_failures_of_a_temporary = value_initializer().check();
+ if ( num_failures_of_a_temporary > 0 )
+ {
+ std::cout << " Number of initialization failures of a temporary: "
+ << num_failures_of_a_temporary << std::endl;
+ }
+ dirty_stack();
+ value_initializer object_on_stack;
+ const unsigned num_failures_on_stack = object_on_stack.check();
+ if ( num_failures_of_a_temporary > 0 || num_failures_on_stack > 0 )
+ {
+ std::cout << " Number of initialization failures on the stack: "
+ << num_failures_on_stack << std::endl;
+ }
     const value_initializer* const ptr = new value_initializer();
     const unsigned num_failures_on_heap = ptr->check();
     delete ptr;
- if ( num_failures_on_stack > 0 || num_failures_on_heap > 0 )
+
+ const unsigned total_num_failures = num_failures_of_a_temporary + num_failures_on_stack + num_failures_on_heap;
+ if ( total_num_failures > 0 )
     {
- std::cout << "Number of initialization failures on the stack: " << num_failures_on_stack
- << "\nNumber of initialization failures on the heap: " << num_failures_on_heap
- << "\nDetected by boost_no_complete_value_initialization::test() revision 9."
+ std::cout << " Number of initialization failures on the heap: "
+ << num_failures_on_heap
+ << "\n Total number of initialization failures ("
+ << num_failures_of_a_temporary << '+'
+ << num_failures_on_stack << '+'
+ << num_failures_on_heap << "): "
+ << total_num_failures
+ << "\nDetected by boost_no_complete_value_initialization::test() revision 10."
         << std::endl;
     }
     return static_cast<int>(num_failures_on_stack + num_failures_on_heap);


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