|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r62097 - sandbox/SOC/2010/bit_masks/lib/integer/test
From: bbartmanboost_at_[hidden]
Date: 2010-05-19 09:14:53
Author: bbartman
Date: 2010-05-19 09:14:53 EDT (Wed, 19 May 2010)
New Revision: 62097
URL: http://svn.boost.org/trac/boost/changeset/62097
Log:
working on completing test suite for bit_wise operators for all masks work for adding asserts into all test for bit wise operators completed
Text files modified:
sandbox/SOC/2010/bit_masks/lib/integer/test/bitwise_low_bits_testing.cpp | 14 +++++++++++---
sandbox/SOC/2010/bit_masks/lib/integer/test/bitwise_operator_test.cpp | 14 +++++++++++---
2 files changed, 22 insertions(+), 6 deletions(-)
Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bitwise_low_bits_testing.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bitwise_low_bits_testing.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bitwise_low_bits_testing.cpp 2010-05-19 09:14:53 EDT (Wed, 19 May 2010)
@@ -16,28 +16,36 @@
template <typename T>
void test_function() {
+ T mask_value( low_bits<T, 1>::value );
+
// operator &(T, low_bits)
T bit_result = T(0) & low_bits<T, 1>();
+ BOOST_ASSERT(( bit_result == (T(0) & mask_value) ));
// operator &(low_bits, T)
bit_result = low_bits<T, 1>() & T(0);
+ BOOST_ASSERT(( bit_result == (mask_value & T(0)) ));
// operator |(T, low_bits)
bit_result = T(0) | low_bits<T, 1>();
-
- // operator |(low_bits, T)
- bit_result = T(0) | low_bits<T,1>();
+ BOOST_ASSERT(( bit_result == (T(0) | mask_value) ));
// operator |(T, low_bits)
bit_result = low_bits<T,1>() | T(0);
+ BOOST_ASSERT(( bit_result == (mask_value | T(0)) ));
// operator ^(low_bits, T)
bit_result = T(0) ^ low_bits<T,1>();
+ BOOST_ASSERT(( bit_result == (T(0) ^ mask_value) ));
// operator ^(T, low_bits)
bit_result = low_bits<T,1>() ^ T(0);
+ BOOST_ASSERT(( bit_result == (mask_value ^ T(0)) ));
+ // operator~(low_bits)
bit_result = ~ (low_bits<T,1>());
+ mask_value = ~mask_value;
+ BOOST_ASSERT(( bit_result == mask_value ));
}
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-19 09:14:53 EDT (Wed, 19 May 2010)
@@ -17,28 +17,36 @@
template <typename T>
void test_function() {
+ T mask_value( bit_mask<T,1>::value );
+
// operator &(T, bit_mask)
T bit_result = T(0) & bit_mask<T, 1>();
+ BOOST_ASSERT(( bit_result == (T(0) & mask_value) ));
// operator &(bit_mask, T)
bit_result = bit_mask<T, 1>() & T(0);
+ BOOST_ASSERT(( bit_result == (mask_value & T(0)) ));
// operator |(T, bit_mask)
bit_result = T(0) | bit_mask<T,1>();
-
- // operator |(bit_mask, T)
- bit_result = T(0) | bit_mask<T,1>();
+ BOOST_ASSERT(( bit_result == (T(0) | mask_value) ));
// operator |(T, bit_mask)
bit_result = bit_mask<T,1>() | T(0);
+ BOOST_ASSERT(( bit_result == (mask_value | T(0)) ));
// operator ^(bit_mask, T)
bit_result = T(0) ^ bit_mask<T,1>();
+ BOOST_ASSERT(( bit_result == (T(0) ^ mask_value) ));
// operator ^(T, bit_mask)
bit_result = bit_mask<T,1>() ^ T(0);
+ BOOST_ASSERT(( bit_result == (mask_value ^ T(0)) ));
+ // operator~(bit_mask)
bit_result = ~ (bit_mask<T,1>());
+ mask_value = ~mask_value;
+ BOOST_ASSERT(( bit_result == mask_value ));
}
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