Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62880 - in sandbox/SOC/2010/bit_masks: boost/integer boost/integer/details/bft lib/integer/test lib/integer/test/bft_testing lib/integer/test/bft_testing/compile_fail
From: bbartmanboost_at_[hidden]
Date: 2010-06-12 18:00:05


Author: bbartman
Date: 2010-06-12 18:00:03 EDT (Sat, 12 Jun 2010)
New Revision: 62880
URL: http://svn.boost.org/trac/boost/changeset/62880

Log:
working on adding precondition testing and other testing implementations
Added:
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/compile_fail/no_array_types.cpp (contents, props changed)
Text files modified:
   sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp | 19 ++++++++-------
   sandbox/SOC/2010/bit_masks/boost/integer/details/bft/name_lookup.hpp | 27 +++++++++++++++++++++
   sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2 | 2 +
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/name_accessor_test.cpp | 50 ++++++++++++++++++++++++++++++++++++++++
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/ref_type_testing.cpp | 12 ++++++++-
   sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_tuple_test.cpp | 24 -------------------
   6 files changed, 99 insertions(+), 35 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-12 18:00:03 EDT (Sat, 12 Jun 2010)
@@ -57,13 +57,7 @@
          * mask - contains all information needed to iteract with data in the
          * the stroage.
          */
- typedef typename MaskInfo::return_type return_type;
- typedef bits_mask<
- storage_type,
- MaskInfo::offset::value,
- MaskInfo::field_width::value
- > mask;
-
+ typedef typename MaskInfo::return_type return_type;
         typedef bit_ref<MaskInfo> _self;
         typedef typename make_unsigned<return_type>::type unsigned_return_type;
         typedef typename make_unsigned<
@@ -79,7 +73,7 @@
             MaskInfo::offset::value + MaskInfo::field_width::value - 1
> bitfield_type;
 
- // typedef typename bitfield_type::value_type somethingl;
+
         /** Reference constructor.
          * Because the bit_ref is an abstraction of a reference then it also
          * must behave like a reference type.
@@ -87,6 +81,13 @@
         bit_ref(storage_type& ref)
             :_ref( *reinterpret_cast<unsigned_storage_type*>(&ref) )
         { }
+
+ /** copy constructor.
+ * This is because references are copy construtible.
+ */
+ // bit_ref( bit_ref<MaskInfo> const& x)
+ // :_ref( x )
+ // { }
         
         /** Implicit conversion operator
          * this allows for implicit conversion to the return_type.
@@ -101,7 +102,7 @@
          */
         _self const& operator=(return_type const& rhs) {
             _ref.set(
- static_cast< typename make_unsigned<storage_type>::type > (rhs));
+ static_cast<typename make_unsigned<storage_type>::type>(rhs));
             return *this;
         }
         

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bft/name_lookup.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bft/name_lookup.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bft/name_lookup.hpp 2010-06-12 18:00:03 EDT (Sat, 12 Jun 2010)
@@ -0,0 +1,27 @@
+// Copyright 2010 Brian Bartman.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_BITFIELD_TUPLE_NAME_LOCATER_HPP
+#define BOOST_BITFIELD_TUPLE_NAME_LOCATER_HPP
+#include <boost/integer/details/bft/bft_element.hpp>
+#include <boost/mpl/find_if.hpp>
+#include <boost/type_traits.hpp>
+
+namespace boost { namespace details {
+
+
+/** This is a lambda expression which is passed to find_if
+ * for processing which can be used to locate a type with a specific name
+ * inside of an mpl sequence type.
+ */
+template <typename T, typename U>
+struct match_name
+ :is_same<typename T::name_type, U>::type
+{ };
+
+
+}} // end boost::details
+
+#endif

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2 (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2 2010-06-12 18:00:03 EDT (Sat, 12 Jun 2010)
@@ -29,8 +29,10 @@
         [ compile-fail bft_testing/compile_fail/bft_no_storage_type.cpp ]
         [ compile-fail bft_testing/compile_fail/non_pod_storage_type.cpp ]
         [ compile-fail bft_testing/compile_fail/bft_storage_width_acceded.cpp ]
+ [ compile-fail bft_testing/compile_fail/no_array_types.cpp ]
         [ compile bft_testing/compile_pass/bft_member_max_out.cpp ]
         [ run bitfield_tuple_test.cpp ]
         [ run bft_testing/ref_type_testing.cpp ]
+ [ run bft_testing/name_accessor_test.cpp ]
     ;
 

Added: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/compile_fail/no_array_types.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/compile_fail/no_array_types.cpp 2010-06-12 18:00:03 EDT (Sat, 12 Jun 2010)
@@ -0,0 +1,19 @@
+// Copyright 2010 Brian Bartman.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#include <boost/integer/bitfield_tuple.hpp>
+
+using namespace boost;
+struct red;
+// This is to make sure that array types don't work.
+typedef bitfield_tuple< storage<int[3]>, member<int,red,3> > bft;
+
+
+int main() {
+ bft(); // don't for get in order make sure that the template works you
+ // either need to construct it or ask for a type in it!
+ return 0;
+}

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/name_accessor_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/name_accessor_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/name_accessor_test.cpp 2010-06-12 18:00:03 EDT (Sat, 12 Jun 2010)
@@ -0,0 +1,50 @@
+// Copyright 2010 Brian Bartman.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#include <boost/integer/bitfield_tuple.hpp>
+#include <boost/assert.hpp>
+#include <boost/integer/details/bft/name_lookup.hpp>
+
+using namespace boost;
+struct red;
+struct green;
+struct pink;
+struct blue;
+struct salmon;
+
+
+ typedef mpl::vector<
+ details::bitfield_element_<
+ int,
+ red,
+ mpl::size_t<0>,
+ mpl::size_t<3>
+ >
+ > test_vect;
+
+int main() {
+
+
+ // tesitng so I can learn to use mpl::find_if
+ // for looking up while useing the get<> function in side bitfield_tuple.
+ typedef mpl::find_if<
+ test_vect,
+ details::match_name<
+ mpl::_1,
+ red
+ >
+ >::type temp_located;
+
+ BOOST_MPL_ASSERT_NOT((
+ is_same<
+ temp_located,
+ mpl::end<
+ test_vect
+ >::type
+ >
+ ));
+ return 0;
+}

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/ref_type_testing.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/ref_type_testing.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/ref_type_testing.cpp 2010-06-12 18:00:03 EDT (Sat, 12 Jun 2010)
@@ -8,13 +8,13 @@
 #include <boost/assert.hpp>
 using namespace boost;
 struct red { };
-
+struct blue { };
 
 
 typedef bitfield_tuple<
     storage<int>,
     member<int, red, 15u>,
- member<int, red, 17u>
+ member<int, blue, 17u>
> bft;
 
 
@@ -89,6 +89,14 @@
         BOOST_ASSERT(( ref_2 == 'q' ));
         BOOST_ASSERT(( ref_3 == 'r' ));
         BOOST_ASSERT(( ref_4 == 's' ));
+
+ // testing copy constructor
+ // ref_type_1 copy_of_ref_1( ref_1 );
+ // BOOST_ASSERT(( copy_of_ref_1 == ref_1 ));
+ // BOOST_ASSERT(( copy_of_ref_1 == 'p' ));
+
     }
+
+
     return 0;
 }

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-12 18:00:03 EDT (Sat, 12 Jun 2010)
@@ -21,10 +21,6 @@
     BOOST_ASSERT(( x.get_data() == value ));
 }
 
-template <typename T, typename U>
-struct match_name
- :is_same<typename T::name_type, U>::type
-{ };
 
 int main() {
     // lets make some errors : )
@@ -154,26 +150,6 @@
>
     ));
 
- typedef mpl::vector<
- details::bitfield_element_<
- int,
- red,
- mpl::size_t<0>,
- mpl::size_t<3>
- >
- > temp_vect;
-
- // tesitng so I can learn to use mpl::find_if
- // for looking up while useing the get<> function in side bitfield_tuple.
- typedef mpl::find_if<temp_vect, match_name<mpl::_1, red> >::type temp_located;
- BOOST_MPL_ASSERT_NOT((
- is_same<
- temp_located,
- mpl::end<temp_vect>::type
- >
- ));
-
-
     }
 
     // bitfield_tuple runtime tests.


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