Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64445 - in sandbox/SOC/2010/bit_masks: . boost/integer/detail/bft lib/integer/test lib/integer/test/bft_testing lib/integer/test/bft_testing/compile_fail
From: bbartmanboost_at_[hidden]
Date: 2010-07-29 10:47:07


Author: bbartman
Date: 2010-07-29 10:47:05 EDT (Thu, 29 Jul 2010)
New Revision: 64445
URL: http://svn.boost.org/trac/boost/changeset/64445

Log:
updating test suite and adding slight tweeks to some of the different test which I mistakenly missed the first time around
Added:
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/compile_fail/pointer_member_with_zero_mask.cpp (contents, props changed)
Text files modified:
   sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/arg_parsing_meta_functions.hpp | 8 ++++++--
   sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2 | 1 +
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/clz_ctz_test.cpp | 4 ++++
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/compile_fail/bft_storage_width_acceded.cpp | 3 ++-
   sandbox/SOC/2010/bit_masks/notes.txt | 3 +--
   5 files changed, 14 insertions(+), 5 deletions(-)

Modified: sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/arg_parsing_meta_functions.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/arg_parsing_meta_functions.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/detail/bft/arg_parsing_meta_functions.hpp 2010-07-29 10:47:05 EDT (Thu, 29 Jul 2010)
@@ -68,9 +68,11 @@
             IndexingMask::offset - 1
>,
         ZeroCount + 1,
- ((IndexingMask::value & Mask::value) == 0)
+ bool((IndexingMask::value & Mask::value) == 0)
+ // &&
+ // (IndexingMask::offset >= 0)
           &&
- (IndexingMask::offset >= 0)
+ bool( ZeroCount < std::size_t(bit_width< typename Mask::value_type >::value))
>
 { };
 
@@ -118,6 +120,8 @@
             mpl::size_t<
             bit_width< typename Mask::value_type >::value >
>::type::value ))
+ &&
+ bool( ZeroCount < std::size_t(bit_width< typename Mask::value_type >::value))
>
 { };
 

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-29 10:47:05 EDT (Thu, 29 Jul 2010)
@@ -34,6 +34,7 @@
         [ compile-fail bft_testing/compile_fail/bft_storage_width_acceded.cpp ]
         [ compile-fail bft_testing/compile_fail/set_storage_more_then_once.cpp ]
         [ compile-fail bft_testing/compile_fail/one_name_two_members.cpp ]
+ [ compile-fail bft_testing/compile_fail/pointer_member_with_zero_mask.cpp ]
         [ compile bft_testing/compile_pass/bft_member_max_out.cpp ]
         [ run bft_testing/bitfield_tuple_test.cpp ]
         [ run bft_testing/name_accessor_test.cpp ]

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/clz_ctz_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/clz_ctz_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/clz_ctz_test.cpp 2010-07-29 10:47:05 EDT (Thu, 29 Jul 2010)
@@ -15,6 +15,7 @@
 typedef bits_mask< int, 2, bit_width<int>::value - 4> mask_1;
 typedef bits_mask< int, 4, bit_width<int>::value - 4> mask_2;
 typedef bits_mask< int, 0, bit_width<int>::value - 4> mask_3;
+typedef integral_mask<int,0> mask_4;
 int main() {
     // count leading zeros' test
     {
@@ -22,6 +23,7 @@
         BOOST_TEST( count_leading_zeros<mask_1>::type::value == 2);
         BOOST_TEST( count_leading_zeros<mask_2>::type::value == 0);
         BOOST_TEST( count_leading_zeros<mask_3>::type::value == 4);
+ BOOST_TEST( count_leading_zeros<mask_4>::type::value == 32);
     }
 
     // count trailing zeros' test
@@ -30,6 +32,8 @@
         BOOST_TEST( count_trailing_zeros<mask_1>::type::value == 2);
         BOOST_TEST( count_trailing_zeros<mask_2>::type::value == 4);
         BOOST_TEST( count_trailing_zeros<mask_3>::type::value == 0);
+ BOOST_TEST( count_trailing_zeros<mask_4>::type::value == 32);
+
 
     }
     return boost::report_errors();

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/compile_fail/bft_storage_width_acceded.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/compile_fail/bft_storage_width_acceded.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/compile_fail/bft_storage_width_acceded.cpp 2010-07-29 10:47:05 EDT (Thu, 29 Jul 2010)
@@ -3,11 +3,12 @@
 // (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#include <iostream>
+
 #include <boost/integer/bitfield_tuple.hpp>
 
 using namespace boost;
 using namespace boost::bitfields;
+
 struct red { };
 
 // Fails because the members exced the number of bits inside of

Added: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/compile_fail/pointer_member_with_zero_mask.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/compile_fail/pointer_member_with_zero_mask.cpp 2010-07-29 10:47:05 EDT (Thu, 29 Jul 2010)
@@ -0,0 +1,25 @@
+// 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;
+using namespace boost::bitfields;
+
+struct red { };
+
+// failes because the mask for the pointer has a value of 0.
+typedef bitfield_tuple<
+ storage<int>,
+ pointer<int,red,integral_constant<bitfields::detail::ptr_mask_type, 0> >
+> bft;
+
+
+
+int main() {
+ bft();
+ return 0;
+}

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-29 10:47:05 EDT (Thu, 29 Jul 2010)
@@ -8,7 +8,7 @@
     "Ensures the offset of the next bit field is divisible by the supplied value."
 
 -> 6) consider renaming member to field or bitfield
-7) Consider moving everything from bitfield_tuple into its own library.
+-> 7) Consider moving everything from bitfield_tuple into its own library.
 
 8) begin relocating all parts of the interface into the bitfield_tuple file.
     Things which I know need to eventually move.
@@ -76,7 +76,6 @@
                         TO BE ADDED TO TESTS SECTION
     Test which need to be created as a result of modifications or additions!
 --------------------------------------------------------------------------------
-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
     pointer.


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