Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64515 - in sandbox/SOC/2010/bit_masks: boost/integer/detail/bitfield_vector lib/integer/test/bitfield_vector_testing
From: bbartmanboost_at_[hidden]
Date: 2010-08-01 07:59:34


Author: bbartman
Date: 2010-08-01 07:59:33 EDT (Sun, 01 Aug 2010)
New Revision: 64515
URL: http://svn.boost.org/trac/boost/changeset/64515

Log:
implemented comprehensive test suite for allocator integration with bitfield_vector's base and base impl classes
Text files modified:
   sandbox/SOC/2010/bit_masks/boost/integer/detail/bitfield_vector/bitfield_vector_base.hpp | 2
   sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/bitfield_vector_base_test.cpp | 74 ++++++++++++++++++++++++++++++++++++---
   2 files changed, 69 insertions(+), 7 deletions(-)

Modified: sandbox/SOC/2010/bit_masks/boost/integer/detail/bitfield_vector/bitfield_vector_base.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/detail/bitfield_vector/bitfield_vector_base.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/detail/bitfield_vector/bitfield_vector_base.hpp 2010-08-01 07:59:33 EDT (Sun, 01 Aug 2010)
@@ -31,7 +31,7 @@
             _bits_in_use(0)
         { }
 
- bitfield_vector_impl(const rebound_alloc_type& alloc)
+ bitfield_vector_impl( rebound_alloc_type const& alloc)
             :rebound_alloc_type(alloc),
             _start(0),
             _end(0),

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/bitfield_vector_base_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/bitfield_vector_base_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/bitfield_vector_base_test.cpp 2010-08-01 07:59:33 EDT (Sun, 01 Aug 2010)
@@ -98,6 +98,7 @@
     T,
     alloc
> vector_base_type;
+
 int main() {
     // Checking typedefs
     {
@@ -125,7 +126,7 @@
>::type::value
         ));
     }
-
+ reset_allocator_test_variables();
     // testing impl type
     {
         typedef vector_base_type::bitfield_vector_impl vect_impl;
@@ -143,7 +144,19 @@
         BOOST_TEST(temp_default_constructed._start == 0 );
         BOOST_TEST(temp_default_constructed._end == 0 );
         BOOST_TEST(temp_default_constructed._bits_in_use == 0 );
-
+ }
+ BOOST_TEST( allocation_size == 0 );
+ BOOST_TEST( default_constructor_called );
+ BOOST_TEST( !allocator_copy_called );
+ BOOST_TEST( !copy_other_allocator_called );
+ BOOST_TEST( destructor_called );
+ BOOST_TEST( ptr_deallocation_address == 0);
+ BOOST_TEST( deallocation_size == 0);
+ BOOST_TEST( !allocate_called );
+ BOOST_TEST( !deallocate_called );
+ reset_allocator_test_variables();
+ {
+ typedef vector_base_type::bitfield_vector_impl vect_impl;
         alloc temp_alloc;
         vect_impl temp_allocator_constructed(temp_alloc);
 
@@ -151,7 +164,16 @@
         BOOST_TEST(temp_allocator_constructed._end == 0 );
         BOOST_TEST(temp_allocator_constructed._bits_in_use == 0 );
     }
-
+ BOOST_TEST( allocation_size == 0 );
+ BOOST_TEST( default_constructor_called );
+ BOOST_TEST( allocator_copy_called );
+ BOOST_TEST( copy_other_allocator_called );
+ BOOST_TEST( destructor_called );
+ BOOST_TEST( ptr_deallocation_address == 0);
+ BOOST_TEST( deallocation_size == 0);
+ BOOST_TEST( !allocate_called );
+ BOOST_TEST( !deallocate_called );
+ reset_allocator_test_variables();
     // testing constructors for bitfield_vector_base
     {
         // Default Constructor.
@@ -160,6 +182,16 @@
         BOOST_TEST(default_constructed._impl._end == 0 );
         BOOST_TEST(default_constructed._impl._bits_in_use == 0 );
     }
+ BOOST_TEST( allocation_size == 0 );
+ BOOST_TEST( default_constructor_called );
+ BOOST_TEST( !allocator_copy_called );
+ BOOST_TEST( !copy_other_allocator_called );
+ BOOST_TEST( destructor_called );
+ BOOST_TEST( ptr_deallocation_address == 0);
+ BOOST_TEST( deallocation_size == 0);
+ BOOST_TEST( !allocate_called );
+ BOOST_TEST( !deallocate_called );
+ reset_allocator_test_variables();
     {
         // Allocator Constructor
         alloc temp_alloc;
@@ -168,21 +200,51 @@
         BOOST_TEST(allocator_constructed._impl._end == 0 );
         BOOST_TEST(allocator_constructed._impl._bits_in_use == 0 );
     }
+ BOOST_TEST( allocation_size == 0 );
+ BOOST_TEST( allocator_copy_called );
+ BOOST_TEST( default_constructor_called );
+ BOOST_TEST( copy_other_allocator_called );
+ BOOST_TEST( destructor_called );
+ BOOST_TEST( ptr_deallocation_address == 0);
+ BOOST_TEST( deallocation_size == 0);
+ BOOST_TEST( !allocate_called );
+ BOOST_TEST( !deallocate_called );
+ reset_allocator_test_variables();
     {
         // N Constructor
         vector_base_type n_array_constructed(3);
-// BOOST_TEST(n_array_constructed._impl._start != 0 );
-// BOOST_TEST(n_array_constructed._impl._end != 0 );
+ BOOST_TEST(n_array_constructed._impl._start != 0 );
+ BOOST_TEST(n_array_constructed._impl._end != 0 );
         BOOST_TEST(n_array_constructed._impl._bits_in_use == 0 );
     }
+ BOOST_TEST( allocation_size == 3 );
+ BOOST_TEST( !allocator_copy_called );
+ BOOST_TEST( default_constructor_called );
+ BOOST_TEST( !copy_other_allocator_called );
+ BOOST_TEST( destructor_called );
+ BOOST_TEST( ptr_deallocation_address == (void*)0xdeadbeef );
+ BOOST_TEST( deallocation_size == 3 );
+ BOOST_TEST( allocate_called );
+ BOOST_TEST( deallocate_called );
+ reset_allocator_test_variables();
     {
         alloc temp_alloc;
         // N + Allocator Constructor
         vector_base_type n_plus_allocator_array_constructed(3, temp_alloc);
-// BOOST_TEST(n_plus_allocator_array_constructed._impl._start != 0 );
+ BOOST_TEST(n_plus_allocator_array_constructed._impl._start != 0 );
         BOOST_TEST(n_plus_allocator_array_constructed._impl._end != 0 );
         BOOST_TEST(n_plus_allocator_array_constructed._impl._bits_in_use == 0 );
     }
+ BOOST_TEST( allocation_size == 3 );
+ BOOST_TEST( allocator_copy_called );
+ BOOST_TEST( default_constructor_called );
+ BOOST_TEST( copy_other_allocator_called );
+ BOOST_TEST( destructor_called );
+ BOOST_TEST( ptr_deallocation_address == (void*)0xdeadbeef );
+ BOOST_TEST( deallocation_size == 3 );
+ BOOST_TEST( allocate_called );
+ BOOST_TEST( deallocate_called );
+ reset_allocator_test_variables();
     {
     }
     return boost::report_errors();


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