Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62045 - sandbox/SOC/2010/bit_masks/lib/integer/test
From: bbartmanboost_at_[hidden]
Date: 2010-05-16 15:12:27


Author: bbartman
Date: 2010-05-16 15:12:26 EDT (Sun, 16 May 2010)
New Revision: 62045
URL: http://svn.boost.org/trac/boost/changeset/62045

Log:
working on overloads for bitwise operators
Text files modified:
   sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2 | 1 +
   sandbox/SOC/2010/bit_masks/lib/integer/test/bitwise_operator_test.cpp | 32 ++++++++++----------------------
   2 files changed, 11 insertions(+), 22 deletions(-)

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-05-16 15:12:26 EDT (Sun, 16 May 2010)
@@ -19,5 +19,6 @@
         [ run high_bit_mask_test.cpp ]
         [ run low_bit_mask_test.cpp ]
         [ run bit_width_test.cpp ]
+ [ run bitwise_operator_test.cpp ]
     ;
 

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bitwise_operator_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bitwise_operator_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bitwise_operator_test.cpp 2010-05-16 15:12:26 EDT (Sun, 16 May 2010)
@@ -6,32 +6,19 @@
 
 
 #include "test_type_list.hpp"
+#include <boost/integer/high_low_bits.hpp>
+#include <boost/integer/bit_mask.hpp>
 #include <boost/integer/details/bit_mask_function_support.hpp>
 
+void ignore_unused(...) { }
+
 // Testing for operator overloads.
 using namespace boost;
 
 template <typename T>
 void test_function() {
-
- // making sure that the value type is transfered correctly.
- BOOST_ASSERT((is_same< typename high_bits<T, 3>::value_type, T >::value));
-
-
- BOOST_ASSERT(( boost::high_bits<T,1>::value == ~(~(T(0)) >> 1) ));
- BOOST_ASSERT(( boost::high_bits<T,2>::value == ~(~(T(0)) >> 2) ));
- BOOST_ASSERT(( boost::high_bits<T,3>::value == ~(~(T(0)) >> 3) ));
- BOOST_ASSERT(( boost::high_bits<T,4>::value == ~(~(T(0)) >> 4) ));
- BOOST_ASSERT(( boost::high_bits<T,5>::value == ~(~(T(0)) >> 5) ));
- BOOST_ASSERT(( boost::high_bits<T,6>::value == ~(~(T(0)) >> 6) ));
- BOOST_ASSERT(( boost::high_bits<T,7>::value == ~(~(T(0)) >> 7) ));
- BOOST_ASSERT(( boost::high_bits<T,8>::value == ~(~(T(0)) >> 8) ));
-
- // assert that type returns the correct typedef.
- BOOST_ASSERT(( is_same<
- typename high_bits<T, 3>::type,
- high_bits<T, 3> >::value
- ));
+ T bitwise_and = T(0) & bit_mask<T, 1>()();
+ ignore_unused( bitwise_and );
 }
 
 
@@ -39,14 +26,15 @@
     template< typename U >
     void operator()(U) {
         test_function<U>();
-
     }
 };
 
 
 int main() {
     mpl::for_each< test_types >( type_tester() );
- mpl::for_each< test_types_2 >( type_tester() );
- mpl::for_each< test_types_3 >( type_tester() );
+ // mpl::for_each< test_types_2 >( type_tester() );
+ // mpl::for_each< test_types_3 >( type_tester() );
+ char bitwise_and = char(0) & bit_mask<char, 1>();
+ ignore_unused( bitwise_and );
     return 0;
 }


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