Ticket #1302: add_as_literal.patch
File add_as_literal.patch, 2.9 KB (added by , 15 years ago) |
---|
-
iterator_range.cpp
23 23 #include <boost/test/unit_test.hpp> 24 24 #include <iostream> 25 25 #include <string> 26 #include <boost/range/as_literal.hpp> 26 27 27 28 using namespace boost; 28 29 using namespace std; … … 79 80 BOOST_CHECK( rr.equal( r ) ); 80 81 81 82 rr = make_iterator_range( str.begin(), str.begin() + 5 ); 82 BOOST_CHECK( rr == "hello");83 BOOST_CHECK( rr != "hell");84 BOOST_CHECK( rr < "hello dude");85 BOOST_CHECK( "hello"== rr );86 BOOST_CHECK( "hell"!= rr );87 BOOST_CHECK( ! ( "hello dude"< rr ) );83 BOOST_CHECK( rr == as_literal("hello") ); 84 BOOST_CHECK( rr != as_literal("hell") ); 85 BOOST_CHECK( rr < as_literal("hello dude") ); 86 BOOST_CHECK( as_literal("hello") == rr ); 87 BOOST_CHECK( as_literal("hell") != rr ); 88 BOOST_CHECK( ! (as_literal("hello dude") < rr ) ); 88 89 irange rrr = rr; 89 90 BOOST_CHECK( rrr == rr ); 90 91 BOOST_CHECK( !( rrr != rr ) ); … … 96 97 BOOST_CHECK_EQUAL( cr[1], 'e' ); 97 98 98 99 rrr = make_iterator_range( str, 1, -1 ); 99 BOOST_CHECK( rrr == "ello worl");100 BOOST_CHECK( rrr == as_literal("ello worl") ); 100 101 rrr = make_iterator_range( rrr, -1, 1 ); 101 102 BOOST_CHECK( rrr == str ); 102 103 -
sub_range.cpp
21 21 #include <iostream> 22 22 #include <string> 23 23 #include <vector> 24 #include <boost/range/as_literal.hpp> 24 25 25 26 using namespace boost; 26 27 using namespace std; … … 110 111 BOOST_CHECK( rr.equal( r ) ); 111 112 112 113 rr = make_iterator_range( str.begin(), str.begin() + 5 ); 113 BOOST_CHECK( rr == "hello");114 BOOST_CHECK( rr != "hell");115 BOOST_CHECK( rr < "hello dude");116 BOOST_CHECK( "hello"== rr );117 BOOST_CHECK( "hell"!= rr );118 BOOST_CHECK( ! ( "hello dude"< rr ) );114 BOOST_CHECK( rr == as_literal("hello") ); 115 BOOST_CHECK( rr != as_literal("hell") ); 116 BOOST_CHECK( rr < as_literal("hello dude") ); 117 BOOST_CHECK( as_literal("hello") == rr ); 118 BOOST_CHECK( as_literal("hell") != rr ); 119 BOOST_CHECK( ! (as_literal("hello dude") < rr ) ); 119 120 120 121 irange rrr = rr; 121 122 BOOST_CHECK( rrr == rr ); … … 128 129 BOOST_CHECK_EQUAL( cr[1], 'e' ); 129 130 130 131 rrr = make_iterator_range( str, 1, -1 ); 131 BOOST_CHECK( rrr == "ello worl");132 BOOST_CHECK( rrr == as_literal("ello worl") ); 132 133 rrr = make_iterator_range( rrr, -1, 1 ); 133 134 BOOST_CHECK( rrr == str ); 134 135 rrr.front() = 'H'; … … 134 135 rrr.front() = 'H'; 135 136 rrr.back() = 'D'; 136 137 rrr[1] = 'E'; 137 BOOST_CHECK( rrr == "HEllo worlD");138 BOOST_CHECK( rrr == as_literal("HEllo worlD") ); 138 139 } 139 140 140 141 #include <boost/test/unit_test.hpp>