Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62888 - in sandbox/SOC/2010/bit_masks/lib/integer/test: . bft_testing
From: bbartmanboost_at_[hidden]
Date: 2010-06-12 19:38:56


Author: bbartman
Date: 2010-06-12 19:38:55 EDT (Sat, 12 Jun 2010)
New Revision: 62888
URL: http://svn.boost.org/trac/boost/changeset/62888

Log:
implemeting twos complement for the bitfield_tuple so that I can store negative numbers.
Added:
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/twos_complement_testing.cpp (contents, props changed)
Text files modified:
   sandbox/SOC/2010/bit_masks/lib/integer/test/Jamfile.v2 | 1 +
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/get_interface_test.cpp | 19 ++++++++++++++++---
   2 files changed, 17 insertions(+), 3 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-06-12 19:38:55 EDT (Sat, 12 Jun 2010)
@@ -37,5 +37,6 @@
         [ run bft_testing/ref_type_testing.cpp ]
         [ run bft_testing/name_accessor_test.cpp ]
         [ run bft_testing/get_interface_test.cpp ]
+ [ run bft_testing/two_complement_testing.cpp ]
     ;
 

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/get_interface_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/get_interface_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/get_interface_test.cpp 2010-06-12 19:38:55 EDT (Sat, 12 Jun 2010)
@@ -19,14 +19,27 @@
     member<char,red,4>,
     member<unsigned char, green,5>,
     storage<std::size_t>,
- member<int, blue, 16>
+ member<int, salmon, 16>
> test_tuple;
-void const_interface_testing() {
+template <typename T>
+void const_interface_testing(T const& x) {
     
 }
 
 int main() {
+ // testing look up interface
     {
- }
+ test_tuple test_1;
+ test_1.get<green>() = 15;
+ test_1.get<red>() = 14;
+ test_1.get<salmon>() = 6;
+ BOOST_ASSERT((test_1.get<green>() == 15));
+ BOOST_ASSERT((test_1.get<red>() == 14));
+ BOOST_ASSERT(( test_1.get<salmon>() == 6));
+
+ // testing negative values
+ test_1.get<salmon>() = -6;
+ //BOOST_ASSERT(( test_1.get<salmon>() == -6));
+ }
     return 0;
 }

Added: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/twos_complement_testing.cpp
==============================================================================


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