|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r64724 - sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing
From: bbartmanboost_at_[hidden]
Date: 2010-08-10 08:27:35
Author: bbartman
Date: 2010-08-10 08:27:28 EDT (Tue, 10 Aug 2010)
New Revision: 64724
URL: http://svn.boost.org/trac/boost/changeset/64724
Log:
worked on fixing up my test suite for bitfield_vector's proxy_reference_type which broke the proxy reference type
Text files modified:
sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/proxy_reference_test.cpp | 104 +++++++++++++++++++++++++++++++++++++--
sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/test_utility.hpp | 8 +++
2 files changed, 105 insertions(+), 7 deletions(-)
Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/proxy_reference_test.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/proxy_reference_test.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/proxy_reference_test.cpp 2010-08-10 08:27:28 EDT (Tue, 10 Aug 2010)
@@ -275,7 +275,7 @@
std::memset(ptr,0,20);
test_type_1 t1(ptr, 0);
t1 = 0x7;
- std::cout << std::hex << std::size_t(*ptr) << std::endl;
+ // std::cout << std::hex << std::size_t(*ptr) << std::endl;
print_mask_details(t1);
BOOST_TEST(*ptr == 0xE0);
@@ -286,7 +286,7 @@
std::memset(ptr,0,1);
test_type_1 t2(ptr, 2);
t2 = 0x7;
- std::cout << std::hex << std::size_t(*ptr) << std::endl;
+ // std::cout << std::hex << std::size_t(*ptr) << std::endl;
print_mask_details(t2);
BOOST_TEST(*ptr == 0x38);
@@ -297,10 +297,10 @@
test_type_1 t3(ptr, 6);
t3 = 0x7;
- std::cout << std::hex << std::size_t(*ptr) << std::endl;
+ // std::cout << std::hex << std::size_t(*ptr) << std::endl;
BOOST_TEST(t2 == 7);
++ptr;
- std::cout << std::hex << std::size_t(*ptr) << std::endl;
+ // std::cout << std::hex << std::size_t(*ptr) << std::endl;
BOOST_TEST(*ptr == 0x80);
ptr = storage;
@@ -319,14 +319,104 @@
BOOST_TEST(t4 == 0x1FFFF);
t4 = 17;
BOOST_TEST(t4 == 17);
-
+ }
+ {
std::cout << "-----------------------------------------" << std::endl;
std::cout << "memory corruption testing." << std::endl;
+ std::cout << "-----------------------------------------" << std::endl
+ << std::endl << std::endl;
+
+
+ typedef unsigned char storage_type;
+ typedef storage_type* storage_ptr;
+ storage_type storage[20];
+ storage_ptr ptr = storage;
+ std::memset(ptr,0,20);
+
+
std::cout << "-----------------------------------------" << std::endl;
- // test_type_4 t4(ptr,0);
- // BOOST_TEST(false);
+ std::cout << " Testing type: " << typestr<test_type_1>() <<std::endl;
+ std::cout << "-----------------------------------------" << std::endl;
+ test_type_1 t1(ptr,0);
+ test_type_1 t2(ptr,3);
+ test_type_1 t3(ptr,6);
+ ++ptr;
+ test_type_1 t4(ptr,1);
+ test_type_1 t5(ptr,4);
+ test_type_1 t6(ptr,7);
+ ++ptr;
+ test_type_1 t7(ptr,2);
+ test_type_1 t8(ptr,5);
+
+ t1 = 0;
+ t2 = 1;
+ t3 = 2;
+ t4 = 3;
+ t5 = 5;
+ t6 = 6;
+ t7 = 7;
+ t8 = 0;
+
+
+ BOOST_PRINT_ON_TEST_FAILURE_2(t1, 1);
+ BOOST_PRINT_ON_TEST_FAILURE_2(t2, 2);
+ BOOST_PRINT_ON_TEST_FAILURE_2(t3, 3);
+ BOOST_PRINT_ON_TEST_FAILURE_2(t4, 4);
+ BOOST_PRINT_ON_TEST_FAILURE_2(t5, 5);
+ BOOST_PRINT_ON_TEST_FAILURE_2(t6, 6);
+ BOOST_PRINT_ON_TEST_FAILURE_2(t7, 7);
+ BOOST_PRINT_ON_TEST_FAILURE_2(t8, 0);
+
+ }
+ {
+ std::cout << "-----------------------------------------" << std::endl;
+ std::cout << " Testing type: " << typestr<test_type_2>() <<std::endl;
+ std::cout << "-----------------------------------------" << std::endl;
+ typedef unsigned char storage_type;
+ typedef storage_type* storage_ptr;
+ storage_type storage[20];
+ storage_ptr ptr = storage;
+ std::memset(ptr,0,20);
+
+ test_type_2 t1(ptr,0);
+ test_type_2 t2(ptr,7);
+ test_type_2 t3(ptr,6);
+ ++ptr;
+ test_type_2 t4(ptr,5);
+ test_type_2 t5(ptr,4);
+ test_type_2 t6(ptr,3);
+ ++ptr;
+ test_type_2 t7(ptr,2);
+ test_type_2 t8(ptr,1);
+
+ t1 = 0;
+ t2 = 1;
+ t3 = 2;
+ t4 = 3;
+ t5 = 5;
+ t6 = 6;
+ t7 = 7;
+ t8 = 9;
+
+
+ BOOST_PRINT_ON_TEST_FAILURE_2(t1, 1);
+ BOOST_PRINT_ON_TEST_FAILURE_2(t2, 2);
+ BOOST_PRINT_ON_TEST_FAILURE_2(t3, 3);
+ BOOST_PRINT_ON_TEST_FAILURE_2(t4, 4);
+ BOOST_PRINT_ON_TEST_FAILURE_2(t5, 5);
+ BOOST_PRINT_ON_TEST_FAILURE_2(t6, 6);
+ BOOST_PRINT_ON_TEST_FAILURE_2(t7, 7);
+ BOOST_PRINT_ON_TEST_FAILURE_2(t8, 9);
+
+
/*
+typedef proxy_reference_type<unsigned int, 3> test_type_1;
+typedef proxy_reference_type<unsigned char, 7> test_type_2;
+typedef proxy_reference_type<unsigned long, 9> test_type_3;
+typedef proxy_reference_type<unsigned long long, 17> test_type_4;
+typedef proxy_reference_type<unsigned long long, 50> test_type_5;
+
test_type_1;
test_type_2;
test_type_3;
Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/test_utility.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/test_utility.hpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bitfield_vector_testing/test_utility.hpp 2010-08-10 08:27:28 EDT (Tue, 10 Aug 2010)
@@ -45,6 +45,14 @@
}\
BOOST_TEST( P1 == P2);
+#define BOOST_PRINT_ON_TEST_FAILURE_2(P1, P2) \
+ if(P1 != P2 ) { \
+ std::cout << #P1 << ": " << std::hex << std::size_t(P1) << std::endl; \
+ std::cout << #P2 << ": " << std::hex << std::size_t(P2) << std::endl; \
+ print_mask_details(P1);\
+ }\
+ BOOST_TEST( P1 == P2);
+
struct print_mpl_values {
template<typename T>
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