Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r61998 - sandbox/SOC/2010/bit_masks/lib/integer/test
From: bbartmanboost_at_[hidden]
Date: 2010-05-15 13:03:42


Author: bbartman
Date: 2010-05-15 13:03:41 EDT (Sat, 15 May 2010)
New Revision: 61998
URL: http://svn.boost.org/trac/boost/changeset/61998

Log:
completed test for bit_width meta function
Text files modified:
   sandbox/SOC/2010/bit_masks/lib/integer/test/bit_width_test.cpp | 41 ++++++++++++++++++++++++++++++++-------
   sandbox/SOC/2010/bit_masks/lib/integer/test/high_bit_mask_test.cpp | 6 +---
   2 files changed, 35 insertions(+), 12 deletions(-)

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bit_width_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bit_width_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bit_width_test.cpp 2010-05-15 13:03:41 EDT (Sat, 15 May 2010)
@@ -3,21 +3,46 @@
 // (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#include <boost/assert.hpp>
-#include <boost/type_traits.hpp>
+#include "test_type_list.hpp"
 #include <boost/integer/bit_width.hpp>
 
 // tesitng for bit width.
 using namespace boost;
 
 
+template <typename T>
+void test_function() {
+ BOOST_ASSERT(( bit_width<T>::value == sizeof(T)*8 ));
+}
 
-int main() {
- {
- typedef bit_width<char> bw;
- BOOST_ASSERT(( bw::value == 8 ));
- BOOST_ASSERT(( is_same<bw::value_type, unsigned int>::value ));
- BOOST_ASSERT(( is_same<bw::type, bw>::value ));
+struct type_tester {
+ 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() );
+
+ typedef bit_width<char> bw;
+ BOOST_ASSERT(( bw::value == 8 ));
+ BOOST_ASSERT(( is_same< bw::value_type, unsigned int>::value ));
+ BOOST_ASSERT(( is_same<bw::type, bw>::value ));
+
+ return 0;
+}
+
+/*
+int main() {
+ typedef bit_width<char> bw;
+ BOOST_ASSERT(( bw::value == 8 ));
+ BOOST_ASSERT(( is_same< bw::value_type, unsigned int>::value ));
+ BOOST_ASSERT(( is_same<bw::type, bw>::value ));
     return 0;
 }
+*/

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/high_bit_mask_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/high_bit_mask_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/high_bit_mask_test.cpp 2010-05-15 13:03:41 EDT (Sat, 15 May 2010)
@@ -3,11 +3,9 @@
 // (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#include <boost/detail/lightweight_test.hpp>
-#include <boost/assert.hpp>
-#include <boost/type_traits.hpp>
-#include "test_type_list.hpp"
 
+
+#include "test_type_list.hpp"
 #include <boost/integer/high_low_bits.hpp>
 
 // tesitng for bit width.


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