*** empty log message ***

[SVN r27148]
This commit is contained in:
Thorsten Jørgen Ottosen
2005-02-05 20:07:02 +00:00
parent ed09875157
commit d82d9b9680
13 changed files with 165 additions and 259 deletions

View File

@ -16,19 +16,12 @@
# pragma warn -8057 // unused argument argc/argv in Boost.Test
#endif
#include <boost/range/iterator_range.hpp>
#include <boost/range/sub_range.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/test/test_tools.hpp>
#include <iostream>
#include <string>
#include <vector>
// This should be included before "using namespace boost",
// otherwise gcc headers will be confused with boost::iterator
// namespace.
#include <boost/test/included/unit_test_framework.hpp>
using namespace boost;
using namespace std;
@ -41,10 +34,9 @@ struct add_one
}
};
void check_iterator_range()
void check_sub_range()
{
typedef string::iterator iterator;
typedef string::const_iterator const_iterator;
typedef iterator_range<iterator> irange;
@ -139,16 +131,30 @@ void check_iterator_range()
BOOST_CHECK( rrr == rr );
BOOST_CHECK( !( rrr != rr ) );
BOOST_CHECK( !( rrr < rr ) );
}
const irange cr = make_iterator_range( str );
BOOST_CHECK_EQUAL( cr.front(), 'h' );
BOOST_CHECK_EQUAL( cr.back(), 'd' );
BOOST_CHECK_EQUAL( cr[1], 'e' );
using boost::unit_test_framework::test_suite;
rrr = make_iterator_range( str, 1, -1 );
BOOST_CHECK( rrr == "ello worl" );
rrr = make_iterator_range( rrr, -1, 1 );
BOOST_CHECK( rrr == str );
rrr.front() = 'H';
rrr.back() = 'D';
rrr[1] = 'E';
BOOST_CHECK( rrr == "HEllo worlD" );
}
#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" );
test->add( BOOST_TEST_CASE( &check_iterator_range ) );
test->add( BOOST_TEST_CASE( &check_sub_range ) );
return test;
}