Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62729 - in sandbox/SOC/2010/bit_masks: boost/integer lib/integer/test lib/integer/test/bft_testing
From: bbartmanboost_at_[hidden]
Date: 2010-06-10 09:00:32


Author: bbartman
Date: 2010-06-10 09:00:32 EDT (Thu, 10 Jun 2010)
New Revision: 62729
URL: http://svn.boost.org/trac/boost/changeset/62729

Log:
adding unit tests into the testing framework for bitfield_tuple
Added:
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/
Text files modified:
   sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp | 32 +++++++++++++++++++++++++++++++-
   sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_tuple_test.cpp | 15 ++++++++++++---
   2 files changed, 43 insertions(+), 4 deletions(-)

Modified: sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp 2010-06-10 09:00:32 EDT (Thu, 10 Jun 2010)
@@ -391,7 +391,8 @@
 {
 private:
     typedef details::bitfield_tuple_base<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9> _base;
- typedef typename _base::allocation_base_policy _alloc_base;
+ typedef typename _base::allocation_base_policy _alloc_base;
+ typedef bitfield_tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9> _self;
 
 public:
     typedef typename _base::is_stack_allocated is_stack_allocated;
@@ -402,6 +403,35 @@
 
 
 
+
+ /** Value constructor.
+ * This sets the initial value of the internal data to x.
+ * Also functions as the default constructor.
+ */
+ bitfield_tuple(storage_type x = 0)
+ :_alloc_base(x)
+ { }
+
+ /** Copy constructor. */
+ bitfield_tuple(_self const& x)
+ :_alloc_base( x.data() )
+ { }
+
+ /** "Identical members" copy constructor.
+ * Basically this is used to get the data within a structure whose
+ * bitfields are the same (in the same order) but the storage is
+ * specified in a different place within the template arguments.
+ *
+ * XXX
+ * TODO: The signature of this will need to change possibly to
+ * use enable_if or some form of internal dispatching.
+ * XXX
+ */
+ template <typename T>
+ bitfield_tuple(T const& x);
+
+ // TODO: look into the creation of a member wise constructor.
+
     /** Interface: Stack Allocated.
      * Retuns a copy of the internally stored type.
      */

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_tuple_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_tuple_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_tuple_test.cpp 2010-06-10 09:00:32 EDT (Thu, 10 Jun 2010)
@@ -173,9 +173,18 @@
     ));
 
 
- bft b;
- b.data();
- // BOOST_ASSERT(( ));
+ }
+
+ // bitfield_tuple runtime tests.
+ {
+ // default constructor.
+ typedef bitfield_tuple< storage<int>, member<int,red,3> > bft1;
+ bft1 bft_test_1;
+ BOOST_ASSERT(( bft_test_1.data() == 0 ));
+
+ // value constructor
+ bft1 bft_test_2(5);
+ BOOST_ASSERT(( bft_test_2.data() == 5 ));
 
     }
     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