Boost logo

Boost-Commit :

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


Author: bbartman
Date: 2010-08-08 08:14:43 EDT (Sun, 08 Aug 2010)
New Revision: 64678
URL: http://svn.boost.org/trac/boost/changeset/64678

Log:
finishing up some of the loose ends in my mask creator test suite
Text files modified:
   sandbox/SOC/2010/bit_masks/boost/integer/detail/bitfield_vector/mask_creator.hpp | 7 +++--
   sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/mask_creator_test.cpp | 42 ++++++++++++++++++++++++++++++++++++++++
   2 files changed, 46 insertions(+), 3 deletions(-)

Modified: sandbox/SOC/2010/bit_masks/boost/integer/detail/bitfield_vector/mask_creator.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/detail/bitfield_vector/mask_creator.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/detail/bitfield_vector/mask_creator.hpp 2010-08-08 08:14:43 EDT (Sun, 08 Aug 2010)
@@ -7,6 +7,7 @@
 #define BOOST_BITFIELD_VECTOR_MASK_CREATOR_HPP
 #include "bitfield_vector_base.hpp"
 #include <boost/mpl/size_t.hpp>
+#include <boost/mpl/void.hpp>
 #include <boost/mpl/arithmetic.hpp>
 #include <boost/mpl/if.hpp>
 #include <boost/mpl/equal.hpp>
@@ -251,7 +252,7 @@
     { }
 
     template <typename MaskInfo>
- explicit mask_detail(MaskInfo const&)
+ mask_detail(MaskInfo const&)
         :_offset(MaskInfo::offset),
         _size(MaskInfo::size),
         _last_shift(MaskInfo::last_shift),
@@ -259,7 +260,7 @@
         _last_byte(MaskInfo::last_value)
     { }
 
- explicit mask_detail(mpl::void_* )
+ mask_detail(mpl::void_* )
         :_offset(0),
         _size(0),
         _last_shift(0),
@@ -290,7 +291,7 @@
  * mask detail.
  */
 template <std::size_t Width>
-mask_detail get_mask_info(std::size_t offset) {
+mask_detail get_mask_detail(std::size_t offset) {
     typedef typename create_masks<Width>::type masks;
     switch(offset){
         case 0:

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/mask_creator_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/mask_creator_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/mask_creator_test.cpp 2010-08-08 08:14:43 EDT (Sun, 08 Aug 2010)
@@ -192,6 +192,7 @@
         BOOST_TEST(t3._first_byte==0xf0);
         BOOST_TEST(t3._last_byte==0x0f);
         using namespace boost;
+
         // template ctor
         typedef create_masks<3>::type masks;
         typedef mpl::at_c<masks,0>::type info;
@@ -203,6 +204,47 @@
         BOOST_TEST(t4._first_byte==0xE0);
         BOOST_TEST(t4._last_byte==0x0);
 
+ // testing mpl::void_* constructor.
+ typedef mpl::void_* mpl_void_ptr;
+ mpl_void_ptr mvp = 0;
+ mask_detail t5(mvp);
+ BOOST_TEST(t5._offset==0);
+ BOOST_TEST(t5._size==0);
+ BOOST_TEST(t5._last_shift==0);
+ BOOST_TEST(t5._first_byte==0);
+ BOOST_TEST(t5._last_byte==0);
+ }
+
+ // testing get_mask_detail
+ {
+ mask_detail t1( get_mask_detail<3>(0) );
+ BOOST_TEST(t1._offset == 0);
+ BOOST_TEST(t1._size == 1);
+ BOOST_TEST(t1._last_shift == 5);
+ BOOST_TEST(t1._first_byte == 0xE0);
+ BOOST_TEST(t1._last_byte == 0);
+
+
+ mask_detail t2( get_mask_detail<3>(2) );
+ BOOST_TEST(t2._offset == 2);
+ BOOST_TEST(t2._size == 1);
+ BOOST_TEST(t2._last_shift == 3);
+ BOOST_TEST(t2._first_byte == 0x38);
+ BOOST_TEST(t2._last_byte == 0);
+
+ mask_detail t3( get_mask_detail<50>(1) );
+ BOOST_TEST(t3._offset == 0);
+ BOOST_TEST(t3._size == 0);
+ BOOST_TEST(t3._last_shift == 0);
+ BOOST_TEST(t3._first_byte == 0);
+ BOOST_TEST(t3._last_byte == 0);
+
+ mask_detail t4( get_mask_detail<3>(6) );
+ BOOST_TEST(t4._offset == 6);
+ BOOST_TEST(t4._size == 2);
+ BOOST_TEST(t4._last_shift == 7);
+ BOOST_TEST(t4._first_byte == 0x03);
+ BOOST_TEST(t4._last_byte == 0x80);
     }
     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