v2 upgrade

[SVN r34011]
This commit is contained in:
Thorsten Jørgen Ottosen
2006-05-18 19:17:04 +00:00
parent 1ac9efbd6a
commit dc96b440be
10 changed files with 136 additions and 125 deletions

View File

@ -23,6 +23,7 @@
#include <boost/static_assert.hpp>
#include <boost/type_traits.hpp>
#include <boost/test/test_tools.hpp>
#include <boost/test/unit_test.hpp>
#include <vector>
#include <algorithm>
@ -31,7 +32,7 @@ using namespace std;
void check_iterator()
{
typedef vector<char> vec_t;
typedef vector<int> vec_t;
typedef vec_t::iterator iterator;
typedef pair<iterator,iterator> pair_t;
typedef range_reverse_iterator<pair_t>::type rev_iterator;
@ -40,15 +41,8 @@ void check_iterator()
vec_t vec;
pair_t p = make_pair( vec.begin(), vec.end() );
rev_pair_t rp = make_pair( rbegin( p ), rend( p ) );
char* str = "mutable";
const char* cstr = "not mutable";
char a[] = "mutable";
const char ca[] = "not mutable";
wchar_t* wstr = L"mutable";
const wchar_t* cwstr= L"not mutable";
wchar_t wa[] = L"mutable";
const wchar_t cwa[]= L"not mutable";
int a[] = {1,2,3,4,5,6,7,8,9,10};
const int ca[] = {1,2,3,4,5,6,7,8,9,10,11,12};
BOOST_CHECK( rbegin( vec ) == range_reverse_iterator<vec_t>::type( vec.end() ) );
BOOST_CHECK( rend( vec ) == range_reverse_iterator<vec_t>::type( vec.begin() ) );
BOOST_CHECK( std::distance( rbegin( vec ), rend( vec ) ) == std::distance( begin( vec ), end( vec ) ) );
@ -58,33 +52,16 @@ void check_iterator()
BOOST_CHECK( std::distance( rbegin( p ), rend( p ) ) == std::distance( begin( rp ), end( rp ) ) );
BOOST_CHECK( std::distance( begin( p ), end( p ) ) == std::distance( rbegin( rp ), rend( rp ) ) );
BOOST_CHECK_EQUAL( &*begin( str ), &*( rend( str ) - 1 ) );
BOOST_CHECK_EQUAL( &*( end( str ) - 1 ), &*rbegin( str ) );
BOOST_CHECK_EQUAL( &*begin( cstr ), &*( rend( cstr ) - 1 ) );
BOOST_CHECK_EQUAL( &*( end( cstr ) - 1 ), &*rbegin( cstr ) );
BOOST_CHECK_EQUAL( &*begin( a ), &*( rend( a ) - 1 ) );
BOOST_CHECK_EQUAL( &*( end( a ) - 1 ), &*rbegin( a ) );
BOOST_CHECK_EQUAL( &*begin( ca ), &*( rend( ca ) - 1 ) );
BOOST_CHECK_EQUAL( &*( end( ca ) - 1 ), &*rbegin( ca ) );
BOOST_CHECK_EQUAL( &*begin( wstr ), &*( rend( wstr ) - 1 ) );
BOOST_CHECK_EQUAL( &*( end( wstr ) - 1 ), &*rbegin( wstr ) );
BOOST_CHECK_EQUAL( &*begin( cwstr ), &*( rend( cwstr ) - 1 ) );
BOOST_CHECK_EQUAL( &*( end( cwstr ) - 1 ), &*rbegin( cwstr ) );
BOOST_CHECK_EQUAL( &*begin( wa ), &*( rend( wa ) - 1 ) );
BOOST_CHECK_EQUAL( &*( end( wa ) - 1 ), &*rbegin( wa ) );
BOOST_CHECK_EQUAL( &*begin( cwa ), &*( rend( cwa ) - 1 ) );
BOOST_CHECK_EQUAL( &*( end( cwa ) - 1 ), &*rbegin( cwa ) );
BOOST_CHECK_EQUAL( &*begin( a ), &*( rend( a ) ) );
BOOST_CHECK_EQUAL( &*( end( a ) ), &*rbegin( a ) );
BOOST_CHECK_EQUAL( &*begin( ca ), &*( rend( ca ) ) );
BOOST_CHECK_EQUAL( &*( end( ca ) ), &*rbegin( ca ) );
}
#include <boost/test/unit_test.hpp>
using boost::unit_test::test_suite;
test_suite* init_unit_test_suite( int argc, char* argv[] )
{
test_suite* test = BOOST_TEST_SUITE( "Range Test Suite" );