Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63047 - in sandbox/SOC/2010/bit_masks: boost/integer/details boost/integer/details/bft/ext/fusion lib/integer/test lib/integer/test/bft_testing
From: bbartmanboost_at_[hidden]
Date: 2010-06-17 13:39:56


Author: bbartman
Date: 2010-06-17 13:39:53 EDT (Thu, 17 Jun 2010)
New Revision: 63047
URL: http://svn.boost.org/trac/boost/changeset/63047

Log:
completed testing for iterator fusion integration now moving on to implementation and integration of the rest of the fusion extension
Added:
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/fusion_iterator_testing.cpp (contents, props changed)
Text files modified:
   sandbox/SOC/2010/bit_masks/boost/integer/details/bft/ext/fusion/at_impl.hpp | 39 ++++++++++++++++++
   sandbox/SOC/2010/bit_masks/boost/integer/details/fusion_ext_includes.hpp | 2
   sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2 | 2
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/fusion_integration_testing.cpp | 85 ----------------------------------------
   4 files changed, 42 insertions(+), 86 deletions(-)

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bft/ext/fusion/at_impl.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bft/ext/fusion/at_impl.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bft/ext/fusion/at_impl.hpp 2010-06-17 13:39:53 EDT (Thu, 17 Jun 2010)
@@ -2,3 +2,42 @@
 // 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_FUSION_EXT_AT_IMPL_HPP
+#define BOOST_BITFIELD_TUPLE_FUSION_EXT_AT_IMPL_HPP
+
+namespace boost {
+
+struct bitfield_group_tag;
+
+namespace fusion { namespace extension {
+
+
+template <typename> struct at_impl;
+
+template <>
+struct at_impl< bitfield_group_tag > {
+
+ template <typename BitfieldTuple, typename N>
+ struct apply {
+ typedef typename BitfieldTuple::
+ template bit_ref<
+ mpl::at<
+ typename BitfieldTuple::members,
+ N
+ >::type
+ > type;
+
+ // non-const at function.
+ static type call(BitfieldTuple& bft) {
+ return type( bft.data() );
+ }
+ };
+};
+
+}}} // end boost::fusion::extension
+
+
+
+
+#endif

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/fusion_ext_includes.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/fusion_ext_includes.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/fusion_ext_includes.hpp 2010-06-17 13:39:53 EDT (Thu, 17 Jun 2010)
@@ -13,4 +13,6 @@
 #include <boost/fusion/iterator/key_of.hpp>
 #include <boost/fusion/iterator/value_of_data.hpp>
 #include <boost/fusion/iterator/deref_data.hpp>
+
+
 #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-17 13:39:53 EDT (Thu, 17 Jun 2010)
@@ -39,7 +39,7 @@
         [ run bft_testing/get_interface_test.cpp ]
         [ run bft_testing/twos_complement_testing.cpp ]
         [ compile bft_testing/compile_pass/fusion_includes.cpp ]
+ [ run bft_testing/fusion_iterator_testing.cpp ]
         [ run bft_testing/fusion_integration_testing.cpp ]
-
     ;
 

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/fusion_integration_testing.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/fusion_integration_testing.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/fusion_integration_testing.cpp 2010-06-17 13:39:53 EDT (Thu, 17 Jun 2010)
@@ -34,91 +34,6 @@
         BOOST_MPL_ASSERT(( is_same< tag, fusion::bitfield_tuple_tag> ));
     }
 
- // iterator value_of
- // this is strange to test, because of the construction of the
- // members vector.
- {
- typedef bitfield_tuple_iterator<test_tuple,0> iter;
- typedef fusion::result_of::value_of<iter>::type value_of_result;
- BOOST_MPL_ASSERT(( is_same< value_of_result::return_type, char> ));
- }
-
- // Iterator deref
- {
- typedef bitfield_tuple_iterator<test_tuple,0> Iter;
- test_tuple temp;
- temp.get<red>() = 3;
- Iter it(temp);
- BOOST_ASSERT(( fusion::deref(it) == 3 ));
- }
-
- // iterator next
- {
- typedef bitfield_tuple_iterator<test_tuple,0> Iter;
- test_tuple temp;
- temp.get<green>() = 3;
- Iter it(temp);
- BOOST_ASSERT(( fusion::deref(fusion::next(it)) == 3 ));
- }
-
- // prior
- {
- typedef bitfield_tuple_iterator<test_tuple,0> Iter;
- test_tuple temp;
- temp.get<red>() = 2;
- temp.get<green>() = 3;
- Iter it(temp);
- BOOST_ASSERT(( fusion::deref(fusion::prior(fusion::next(it))) == 2 ));
- }
-
- // distance tesing
- {
- typedef bitfield_tuple_iterator<test_tuple,0> Iter1;
- typedef bitfield_tuple_iterator<test_tuple,1> Iter2;
- test_tuple temp;
- temp.get<red>() = 2;
- temp.get<green>() = 3;
- Iter1 it1(temp);
- Iter2 it2(temp);
- BOOST_ASSERT(( fusion::distance(it2,it1) == 1 ));
- }
-
- // key_of testing
- {
- typedef bitfield_tuple_iterator<test_tuple,1> Iter;
- test_tuple temp;
- BOOST_MPL_ASSERT((
- is_same<
- fusion::result_of::key_of<
- Iter
- >::type,
- green
- >
- ));
- }
-
- // value_of_data testing
- {
-
- typedef bitfield_tuple_iterator<test_tuple,1> Iter;
- typedef fusion::result_of::value_of_data<
- Iter
- >::type value_of_data_t;
-
- test_tuple temp;
- BOOST_MPL_ASSERT((is_same<value_of_data_t::return_type,unsigned char>));
- }
-
- // deref_data testing
- {
- typedef bitfield_tuple_iterator<test_tuple,1> Iter;
- typedef fusion::result_of::deref_data<
- Iter
- >::type deref_data_t;
-
- // test_tuple temp;
- // BOOST_MPL_ASSERT((is_same<deref_data_t::return_type,unsigned char>));
- }
     /*
     bmg_t bmg;
 

Added: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/fusion_iterator_testing.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/fusion_iterator_testing.cpp 2010-06-17 13:39:53 EDT (Thu, 17 Jun 2010)
@@ -0,0 +1,117 @@
+// 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/mpl/assert.hpp>
+#include <boost/integer/details/fusion_ext_includes.hpp>
+
+using namespace boost;
+
+struct red;
+struct green;
+struct pink;
+struct blue;
+struct salmon;
+
+typedef bitfield_tuple<
+ member<char,red,4>,
+ member<unsigned char, green,5>,
+ storage<std::size_t>,
+ member<int, salmon, 16>
+> test_tuple;
+
+
+int main() {
+ // iterator value_of
+ // this is strange to test, because of the construction of the
+ // members vector.
+ {
+ typedef bitfield_tuple_iterator<test_tuple,0> iter;
+ typedef fusion::result_of::value_of<iter>::type value_of_result;
+ BOOST_MPL_ASSERT(( is_same< value_of_result::return_type, char> ));
+ }
+
+ // Iterator deref
+ {
+ typedef bitfield_tuple_iterator<test_tuple,0> Iter;
+ test_tuple temp;
+ temp.get<red>() = 3;
+ Iter it(temp);
+ BOOST_ASSERT(( fusion::deref(it) == 3 ));
+ }
+
+ // iterator next
+ {
+ typedef bitfield_tuple_iterator<test_tuple,0> Iter;
+ test_tuple temp;
+ temp.get<green>() = 3;
+ Iter it(temp);
+ BOOST_ASSERT(( fusion::deref(fusion::next(it)) == 3 ));
+ }
+
+ // prior
+ {
+ typedef bitfield_tuple_iterator<test_tuple,0> Iter;
+ test_tuple temp;
+ temp.get<red>() = 2;
+ temp.get<green>() = 3;
+ Iter it(temp);
+ BOOST_ASSERT(( fusion::deref(fusion::prior(fusion::next(it))) == 2 ));
+ }
+
+ // distance tesing
+ {
+ typedef bitfield_tuple_iterator<test_tuple,0> Iter1;
+ typedef bitfield_tuple_iterator<test_tuple,1> Iter2;
+ test_tuple temp;
+ temp.get<red>() = 2;
+ temp.get<green>() = 3;
+ Iter1 it1(temp);
+ Iter2 it2(temp);
+ BOOST_ASSERT(( fusion::distance(it2,it1) == 1 ));
+ }
+
+ // key_of testing
+ {
+ typedef bitfield_tuple_iterator<test_tuple,1> Iter;
+ test_tuple temp;
+ BOOST_MPL_ASSERT((
+ is_same<
+ fusion::result_of::key_of<
+ Iter
+ >::type,
+ green
+ >
+ ));
+ }
+
+ // value_of_data testing
+ {
+
+ typedef bitfield_tuple_iterator<test_tuple,1> Iter;
+ typedef fusion::result_of::value_of_data<
+ Iter
+ >::type value_of_data_t;
+
+ test_tuple temp;
+ BOOST_MPL_ASSERT((is_same<value_of_data_t::return_type,unsigned char>));
+ }
+
+ // deref_data testing
+ {
+ typedef bitfield_tuple_iterator<test_tuple,1> Iter;
+ typedef fusion::result_of::deref_data<
+ Iter
+ >::type deref_data_t;
+
+ // test_tuple temp;
+ // BOOST_MPL_ASSERT((is_same<deref_data_t::return_type,unsigned char>));
+ }
+
+}
+
+


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