Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r61969 - sandbox/SOC/2010/bit_masks/lib/integer/test
From: bbartmanboost_at_[hidden]
Date: 2010-05-14 12:28:02


Author: bbartman
Date: 2010-05-14 12:28:00 EDT (Fri, 14 May 2010)
New Revision: 61969
URL: http://svn.boost.org/trac/boost/changeset/61969

Log:
still working on making my stuff work with boost test.
Text files modified:
   sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2 | 13 ++-
   sandbox/SOC/2010/bit_masks/lib/integer/test/low_bit_mask_test.cpp | 125 +++++++++++++++++++++++++++++++++------
   2 files changed, 113 insertions(+), 25 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-14 12:28:00 EDT (Fri, 14 May 2010)
@@ -2,17 +2,20 @@
 #~ 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)
 
+
 import testing ;
 
-project : requirements <warnings>all <toolset>gcc:<cxxflags>-Wextra ;
+project
+ : requirements
+ <warnings>all
+ <toolset>gcc:<cxxflags>-Wextra
+ ;
 
 test-suite integer
     :
- [ run mask_check.cpp ]
+ [ run mask_check.cpp ]
         [ run high_bit_mask_test.cpp ]
- [ run low_bit_mask_test.cpp ]
- # [ compile bit_mask_test.cpp ]
+ [ run low_bit_mask_test.cpp ]
         [ run bit_width_test.cpp ]
     ;
 
-# run low_bit_mask_test.cpp

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/low_bit_mask_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/low_bit_mask_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/low_bit_mask_test.cpp 2010-05-14 12:28:00 EDT (Fri, 14 May 2010)
@@ -1,36 +1,121 @@
 
-#include <boost/test/execution_monitor.hpp>
-#include <boost/assert.hpp>
+#include <boost/cstdint.hpp>
+
+// #define BOOST_TEST_MODULE S
+// #include <boost/test/unit_test.hpp>
+// #include <boost/test/test_case_template.hpp>
+#include <boost/test/minimal.hpp>
+#include <boost/mpl/list.hpp>
+#include <boost/mpl/for_each.hpp>
+
+
+// #include <boost/test/execution_monitor.hpp>
+// #include <boost/assert.hpp>
 #include <boost/type_traits.hpp>
 #include <boost/integer/high_low_bits.hpp>
+
 // Testing of low_bits function.
 using namespace boost;
 
-// basic typedef
-typedef low_bits<unsigned int, 3> lbits;
+// testing additional integral types.
+
+// char
+// unsigned char
+// short
+// unsigned short
+// long
+// unsigned long
+// int
+// unsigned int
+// long long
+// unsigned long long
+
+/*
+integer types from boost integer:
+
+int_least8_t
+int_least16_t
+int_least32_t
+uint_least8_t
+uint_least16_t
+uint_least32_t
+
+
+The following types are available only if, after including <boost/cstdint.hpp>,
+the macro BOOST_NO_INT64_T is not defined:
+
+int_least64_t
+uint_least64_t
+
+The following fastest minimum-width integer types are provided for all platforms:
+
+int_fast8_t
+int_fast16_t
+int_fast32_t
+uint_fast8_t
+uint_fast16_t
+uint_fast32_t
+
+The following types are available only if, after including <boost/cstdint.hpp>,
+the macro BOOST_NO_INT64_T is not defined:
+
+int_fast64_t
+uint_fast64_t
+
+/////
+typedef low_bits<T, 3> lbits
+*/
 
-int main() {
 
+
+// BOOST_AUTO_TEST_CASE( my_test )
+// {
+// BOOST_CHECK_EQUAL( (boost::low_bits<int, 3>::value) , 7 );
+//}
+// BOOST_AUTO_TEST_CASE_TEMPLATE( my_test, T, test_types )
+// {
+
     // making sure that the value type is transfered correctly.
- BOOST_ASSERT(( is_same< lbits::value_type, unsigned int >::value ));
+ // BOOST_CHECK( bool i(is_same< typename low_bits<T, 3>::value_type, T >::value) );
 
     // assert that mask is correct.
- BOOST_ASSERT(( lbits::value == 7 ));
+ // T r = typename ::;
+ // BOOST_CHECK( 1 );
 
     // assert that type returns the correct typedef.
- BOOST_ASSERT(( is_same<lbits::type, lbits>::value ));
+ // BOOST_CHECK( bool i2(is_same< typename low_bits<T, 3>::type, low_bits<T, 3> >::value) );
+// }
 
- // testing additional integral types.
- // char
- // unsigned char
- // short
- // unsigned short
- // long
- // unsigned long
- // int
- // unsigned int
- // long long
- // unsigned long long
-
+typedef boost::mpl::list<int,long,unsigned char> test_types;
+
+
+
+template <typename T>
+void test_function() {
+ // making sure that the value type is transfered correctly.
+ BOOST_TEST( (is_same< typename low_bits<T, 3>::value_type, T >::value) );
+
+ // assert that mask is correct.
+ // T r = typename ;
+ BOOST_TEST( boost::low_bits<T,3>::value );
+
+ // assert that type returns the correct typedef.
+ BOOST_TEST( is_same< typename low_bits<T, 3>::type, low_bits<T, 3> >::value );
+}
+
+// basic typedef
+// typedef low_bits<unsigned int, 3> lbits;
+
+struct value_printer {
+ template< typename U >
+ void operator()(U) {
+ test_function<U>();
+ }
+};
+
+
+int test_main(int argc, char** argv) {
+ // test_function<int>();
+ // mpl::for_each<test_types>( value_printer() );
     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