applied patch from Ticket #1302 (new Patches) to handle char arrays correctly

[SVN r40370]
This commit is contained in:
Thorsten Jørgen Ottosen
2007-10-23 18:59:11 +00:00
parent c8ffe55ae5
commit 24466ae189
2 changed files with 17 additions and 15 deletions

View File

@ -19,6 +19,7 @@
#include <boost/range/iterator_range.hpp>
#include <boost/range/functions.hpp>
#include <boost/range/as_literal.hpp>
#include <boost/test/test_tools.hpp>
#include <boost/test/unit_test.hpp>
#include <iostream>
@ -79,12 +80,12 @@ void check_iterator_range()
BOOST_CHECK( rr.equal( r ) );
rr = make_iterator_range( str.begin(), str.begin() + 5 );
BOOST_CHECK( rr == "hello" );
BOOST_CHECK( rr != "hell" );
BOOST_CHECK( rr < "hello dude" );
BOOST_CHECK( "hello" == rr );
BOOST_CHECK( "hell" != rr );
BOOST_CHECK( ! ("hello dude" < rr ) );
BOOST_CHECK( rr == as_literal("hello") );
BOOST_CHECK( rr != as_literal("hell") );
BOOST_CHECK( rr < as_literal("hello dude") );
BOOST_CHECK( as_literal("hello") == rr );
BOOST_CHECK( as_literal("hell") != rr );
BOOST_CHECK( ! (as_literal("hello dude") < rr ) );
irange rrr = rr;
BOOST_CHECK( rrr == rr );
BOOST_CHECK( !( rrr != rr ) );
@ -96,7 +97,7 @@ void check_iterator_range()
BOOST_CHECK_EQUAL( cr[1], 'e' );
rrr = make_iterator_range( str, 1, -1 );
BOOST_CHECK( rrr == "ello worl" );
BOOST_CHECK( rrr == as_literal("ello worl") );
rrr = make_iterator_range( rrr, -1, 1 );
BOOST_CHECK( rrr == str );

View File

@ -17,6 +17,7 @@
#endif
#include <boost/range/sub_range.hpp>
#include <boost/range/as_literal.hpp>
#include <boost/test/test_tools.hpp>
#include <iostream>
#include <string>
@ -110,12 +111,12 @@ void check_sub_range()
BOOST_CHECK( rr.equal( r ) );
rr = make_iterator_range( str.begin(), str.begin() + 5 );
BOOST_CHECK( rr == "hello" );
BOOST_CHECK( rr != "hell" );
BOOST_CHECK( rr < "hello dude" );
BOOST_CHECK( "hello" == rr );
BOOST_CHECK( "hell" != rr );
BOOST_CHECK( ! ("hello dude" < rr ) );
BOOST_CHECK( rr == as_literal("hello") );
BOOST_CHECK( rr != as_literal("hell") );
BOOST_CHECK( rr < as_literal("hello dude") );
BOOST_CHECK( as_literal("hello") == rr );
BOOST_CHECK( as_literal("hell") != rr );
BOOST_CHECK( ! (as_literal("hello dude") < rr ) );
irange rrr = rr;
BOOST_CHECK( rrr == rr );
@ -128,13 +129,13 @@ void check_sub_range()
BOOST_CHECK_EQUAL( cr[1], 'e' );
rrr = make_iterator_range( str, 1, -1 );
BOOST_CHECK( rrr == "ello worl" );
BOOST_CHECK( rrr == as_literal("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" );
BOOST_CHECK( rrr == as_literal("HEllo worlD") );
}
#include <boost/test/unit_test.hpp>