1 // Boost.Range library
2 //
3 //  Copyright Neil Groves 2014. Use, modification and
4 //  distribution is subject to the Boost Software License, Version
5 //  1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 //  http://www.boost.org/LICENSE_1_0.txt)
7 //
8 //
9 // For more information, see http://www.boost.org/libs/range/
10 //
11 #include <boost/range/iterator_range_core.hpp>
12 
13 #include <boost/test/test_tools.hpp>
14 #include <boost/test/unit_test.hpp>
15 #include <string>
16 
17 namespace boost
18 {
19     namespace
20     {
21         class str_ref : public boost::iterator_range<const char*>
22         {
23         public:
str_ref(const std::string & str)24             explicit str_ref(const std::string& str)
25                 : boost::iterator_range<const char*>(
26                     str.c_str(), str.c_str() + str.size())
27             {
28             }
29         };
30 
test_ticket_6715_iterator_range_equality()31         void test_ticket_6715_iterator_range_equality()
32         {
33             std::string src("test");
34             str_ref a(src);
35             str_ref b(src);
36             BOOST_CHECK(a == b);
37         }
38     }
39 }
40 
41 boost::unit_test::test_suite*
init_unit_test_suite(int argc,char * argv[])42 init_unit_test_suite(int argc, char* argv[])
43 {
44     boost::unit_test::test_suite* test
45         = BOOST_TEST_SUITE(
46                    "RangeTestSuite.ticket_6715_iterator_range_equality");
47 
48     test->add(BOOST_TEST_CASE(
49                       &boost::test_ticket_6715_iterator_range_equality));
50 
51     return test;
52 }
53