Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64398 - in sandbox/SOC/2010/bit_masks: . boost/integer/bitfield_tuple lib/integer/test lib/integer/test/bft_testing
From: bbartmanboost_at_[hidden]
Date: 2010-07-27 15:52:28


Author: bbartman
Date: 2010-07-27 15:52:26 EDT (Tue, 27 Jul 2010)
New Revision: 64398
URL: http://svn.boost.org/trac/boost/changeset/64398

Log:
added meta function interface
Added:
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/interface_meta_function_test.cpp (contents, props changed)
Text files modified:
   sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple/interface_metafunctions.hpp | 4 +-
   sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2 | 3 +
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/variadic_sequence_20_test.cpp | 28 +++++++++++++-----
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/variadic_sequence_30_test.cpp | 35 +++++++++++++++++++++--
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/variadic_sequence_40_test.cpp | 51 ++++++++++++++++++++++++++++------
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/variadic_sequence_50_test.cpp | 57 ++++++++++++++++++++++++++++++++++++--
   sandbox/SOC/2010/bit_masks/notes.txt | 58 +++++++++++++++++----------------------
   7 files changed, 175 insertions(+), 61 deletions(-)

Modified: sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple/interface_metafunctions.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple/interface_metafunctions.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple/interface_metafunctions.hpp 2010-07-27 15:52:26 EDT (Tue, 27 Jul 2010)
@@ -54,8 +54,8 @@
 struct find_by_element_index {
 
     BOOST_STATIC_ASSERT((
- mpl::size<typename BitfieldTuple::members>::value
- >
+ std::size_t(mpl::size<typename BitfieldTuple::members>::value)
+ >=
         Index
     ));
 

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-07-27 15:52:26 EDT (Tue, 27 Jul 2010)
@@ -55,10 +55,11 @@
         [ run bft_testing/pointer_member_test.cpp ]
         [ run bft_testing/pointer_parsing_meta_function_test.cpp ]
         [ run bft_testing/fails_on_64_bit.cpp ]
+
         [ run bft_testing/variadic_sequence_20_test.cpp ]
         [ run bft_testing/variadic_sequence_30_test.cpp ]
         [ run bft_testing/variadic_sequence_40_test.cpp ]
         [ run bft_testing/variadic_sequence_50_test.cpp ]
-
+ [ run bft_testing/interface_meta_function_test.cpp ]
     ;
 

Added: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/interface_meta_function_test.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/interface_meta_function_test.cpp 2010-07-27 15:52:26 EDT (Tue, 27 Jul 2010)
@@ -0,0 +1,104 @@
+// 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/detail/lightweight_test.hpp>
+
+using namespace boost;
+using namespace boost::bitfields;
+
+struct red;
+struct green;
+struct pink;
+struct blue;
+struct salmon;
+struct orange;
+
+typedef bitfield_tuple<
+ member<char,red,4>,
+ member<unsigned char, green,5>,
+ storage<std::size_t>,
+ padding<3>,
+ member<int, salmon, 16>,
+ flag<blue>
+> test_tuple;
+
+typedef bitfields::detail::bitfield_element<char,
+ red,
+ mpl::size_t<0>,
+ mpl::size_t<4>
+> bftelem;
+
+typedef test_tuple::bitfield_reference<
+ find_by_element_name<
+ test_tuple,
+ red
+ >::type
+> ref_type;
+int main() {
+ // testing name_exists.
+ {
+ // name does exist
+ BOOST_TEST(( name_exists<test_tuple,red>::type::value ));
+ // name does not exist
+ BOOST_TEST(( !name_exists<test_tuple,orange>::type::value ));
+ }
+ // find_by_element_name
+ {
+ typedef bitfields::detail::bitfield_element<char,
+ red,
+ mpl::size_t<0>,
+ mpl::size_t<4>
+ > bftelem;
+ // name does exist
+ BOOST_TEST((
+ is_same<
+ bftelem,
+ find_by_element_name<
+ test_tuple,
+ red
+ >::type
+ >::type::value
+ ));
+ }
+
+ // find_by_element_index
+ {
+
+ // name does exist
+ BOOST_TEST((
+ is_same<
+ bftelem,
+ find_by_element_index<
+ test_tuple,
+ 0
+ >::type
+ >::type::value
+ ));
+ }
+
+ // get_proxy_reference_type_by_name
+ {
+ // get reference type
+ BOOST_TEST((
+ is_same<
+ get_proxy_reference_type_by_name<test_tuple,red>::type,
+ ref_type
+ >::type::value
+ ));
+ }
+
+ // get_proxy_reference_type_by_index
+ {
+ // get reference type
+ BOOST_TEST((
+ is_same<
+ get_proxy_reference_type_by_index<test_tuple,0>::type,
+ ref_type
+ >::type::value
+ ));
+ }
+ return boost::report_errors();
+}

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/variadic_sequence_20_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/variadic_sequence_20_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/variadic_sequence_20_test.cpp 2010-07-27 15:52:26 EDT (Tue, 27 Jul 2010)
@@ -12,17 +12,29 @@
 using namespace boost;
 using namespace boost::bitfields;
 
-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>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
     flag<blue>
> test_tuple;
 

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/variadic_sequence_30_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/variadic_sequence_30_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/variadic_sequence_30_test.cpp 2010-07-27 15:52:26 EDT (Tue, 27 Jul 2010)
@@ -19,10 +19,37 @@
 struct salmon;
 
 typedef bitfield_tuple<
- member<char,red,4>,
- member<unsigned char, green,5>,
- storage<std::size_t>,
- member<int, salmon, 16>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ // 10
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ // 10
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
     flag<blue>
> test_tuple;
 

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/variadic_sequence_40_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/variadic_sequence_40_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/variadic_sequence_40_test.cpp 2010-07-27 15:52:26 EDT (Tue, 27 Jul 2010)
@@ -11,18 +11,51 @@
 
 using namespace boost;
 using namespace boost::bitfields;
-
-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>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ // 10
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ // 10
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ // 10
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
     flag<blue>
> test_tuple;
 

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/variadic_sequence_50_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/variadic_sequence_50_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/variadic_sequence_50_test.cpp 2010-07-27 15:52:26 EDT (Tue, 27 Jul 2010)
@@ -19,10 +19,59 @@
 struct salmon;
 
 typedef bitfield_tuple<
- member<char,red,4>,
- member<unsigned char, green,5>,
- storage<std::size_t>,
- member<int, salmon, 16>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ // 10
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ // 10
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ // 10
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ // 10
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
+ align<8>,
     flag<blue>
> test_tuple;
 

Modified: sandbox/SOC/2010/bit_masks/notes.txt
==============================================================================
--- sandbox/SOC/2010/bit_masks/notes.txt (original)
+++ sandbox/SOC/2010/bit_masks/notes.txt 2010-07-27 15:52:26 EDT (Tue, 27 Jul 2010)
@@ -37,61 +37,45 @@
                                 Test File Review
 --------------------------------------------------------------------------------
 1) variadic_sequence_testing.cpp
- a) Replicate this test all the way up to 50 at intervals of 10.
- b) Switch to using <boost/detail/lightweight_test.hpp> framework.
- c) Add test to test the limit of the bitfield_tuple so that I can be
- assured that the limit is working correctly.
- d) remove testing from the end of file name.
-
 
 3) template_expansion_marco_test.cpp
     a) Make this an actual test to make sure that everything is correctly
         getting expanded.
     b) Find a better way to test this.
- c) remove test from name.
     d) Change to using the <boost/detail/lightweight_test.hpp> framework.
 
+
+
 4) reference_builder_test.cpp
- a) remove test from name.
     b) Change to using the <boost/detail/lightweight_test.hpp> framework.
- c) test the rest of the reference builder functions
- I ) Name exists
- II ) find_by_element_name
- III ) find_by_element_index
- IV ) make_reference_type_by_name <-- Maybe, if its actually being
- used then I'll make a test for it other wise its going to be
- removed.
- V ) enable_if_reference_type_by_index
- VI ) get_reference_type_by_name
- VII ) get_reference_type_by_index
+
+*) interface_meta_function_test.cpp
 
 5) pointer_parsing_meta_function_test.cpp
- a) Remove test from name.
- c) Other then name this is pretty complete.
 
 6) pointer_member_test.cpp
- a) remove test from name.
+ a) .
     b) This test is incomplete because the implementation isn't completed yet.
     c) I need a macro which will tell me if the test is 32 bit or 64 bit
         Currently the _LP64 should only work for GCC however I need a more
         universal one.
 
 7) name_accessor_test.cpp
- a) remove test from name.
+ a) .
     b) Change to using the <boost/detail/lightweight_test.hpp> framework.
 
 8) make_bft_testing.cpp
- a) remove test from name.
+ a) .
     b) Change to using the <boost/detail/lightweight_test.hpp> framework.
 
 9) make_bft_testing.cpp
- a) remove test from name.
+ a) .
     b) Change to using the <boost/detail/lightweight_test.hpp> framework.
     c) This may need additional test to make sure that the macros are correctly
         generating the code for the correct number of valid parameters.
 
 10) get_interface_test.cpp
- a) remove test from name.
+ a) .
     b) Change to using the <boost/detail/lightweight_test.hpp> framework.
     c) Need to do more const interface testing.
 
@@ -109,33 +93,33 @@
     b) Change to using the <boost/detail/lightweight_test.hpp> framework.
 
 13) flag_test.cpp
- a) remove test from name.
+ a) .
     b) Change to using the <boost/detail/lightweight_test.hpp> framework.
 
 14) filler_test.cpp
- a) remove test from name.
+ a) .
     b) Change to using the <boost/detail/lightweight_test.hpp> framework.
 
 15) deduced_storage_type_test.cpp
- a) remove test from name.
+ a) .
     b) Change to using the <boost/detail/lightweight_test.hpp> framework.
 
 16) deduced_storage_type_long_long_test.cpp
- a) remove test from name.
+ a) .
     b) Change to using the <boost/detail/lightweight_test.hpp> framework.
     c) Maybe merge this with the other storage type.
 
 17) custom_member_test.cpp
- a) remove test from name.
+ a) .
     b) Implement before testing this.
 
 18) bitfield_tuple_test.hpp
- a) remove test from name.
+ a) .
     b) Change to using the <boost/detail/lightweight_test.hpp> framework.
     c) remove previous dependency on test_list_type.hpp
 
 19) align_test.cpp
- a) remove test from name.
+ a) .
     b) Change to using the <boost/detail/lightweight_test.hpp> framework.
 
 20) fails_on_64_bit.cpp
@@ -147,7 +131,7 @@
     Test which need to be created as a result of modifications or additions!
 --------------------------------------------------------------------------------
 1) !DONE! Add interface test for the interface macros. !DONE!
-2) interface meta-function test suite.
+ 2) interface meta-function test suite.
 3) Create additional tests for count leading and trailing zero meta-functions.
 4) Create compile failure test for pointer member mask being 0.
 5) Create compile failure test for pointer member mask not being same size as
@@ -155,6 +139,14 @@
 6) Create compile Failure test for custom member mask being 0.
 7) Create test for element and element_n
 8) Create test for get_free_function.
+9) Create compile failure test for find_by_element_name name does not exist.
+10) Create compile failure test for find_by_element_index index does not exist.
+11) Create compile failure test for get_proxy_reference_type_by_name name does
+ not exist.
+12) Create compile failure test for get_proxy_reference_type_by_index index does
+ not exist.
+
+
 --------------------------------------------------------------------------------
 
 


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