Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64126 - sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing
From: bbartmanboost_at_[hidden]
Date: 2010-07-18 11:08:24


Author: bbartman
Date: 2010-07-18 11:08:23 EDT (Sun, 18 Jul 2010)
New Revision: 64126
URL: http://svn.boost.org/trac/boost/changeset/64126

Log:
completed initial work for test of the bitfield_tuples pointer member
Text files modified:
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/pointer_member_test.cpp | 28 +++++++++++++++++++++++-----
   1 files changed, 23 insertions(+), 5 deletions(-)

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/pointer_member_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/pointer_member_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/pointer_member_test.cpp 2010-07-18 11:08:23 EDT (Sun, 18 Jul 2010)
@@ -6,27 +6,45 @@
 #include <boost/integer/bitfield_tuple.hpp>
 #include <boost/detail/lightweight_test.hpp>
 #include <boost/type_traits/is_same.hpp>
-#include <iostream>
-
 using namespace boost;
 using namespace boost::bitfields;
+
 struct rd;
+struct b1;
+struct b2;
 
 typedef bitfield_tuple< pointer<int, rd> > test_type_1;
+typedef bitfield_tuple< pointer<int, rd>, flag<b1>, flag<b2> > test_type_2;
 // typedef bitfield_tuple< member<int*,rd, bit_width<int*>::value - 2> > test_type_2;
 
 int main() {
     {
     test_type_1 t1;
     int i=0;
- // std::cout << sizeof(&i) << std::endl;
- // BOOST_TEST(false);
+
     t1.get<rd>() = &i;
     BOOST_TEST(*t1.get<rd>() == 0);
+ i = 5;
+ BOOST_TEST(*t1.get<rd>() == 5);
     }
 
- // testing member<int*,rd, width of pointer-2>
+ // double boolean test.
     {
+ test_type_2 t2;
+ int i=0;
+ t2.get<rd>() = &i;
+ BOOST_TEST(*t2.get<rd>() == 0);
+ i = 5;
+ BOOST_TEST(*t2.get<rd>() == 5);
+ BOOST_TEST(t2.get<b1>() == false );
+ BOOST_TEST(t2.get<b2>() == false );
+ t2.get<b1>() = true;
+ t2.get<b2>() = true;
+
+ BOOST_TEST(*t2.get<rd>() == 5);
+ BOOST_TEST(t2.get<b1>() );
+ BOOST_TEST(t2.get<b2>() );
+
     }
     return boost::report_errors();
 }


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