ticket_6944.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Boost.Range library
  2. //
  3. // Copyright Neil Groves 2011. 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/concept_check.hpp>
  12. #include <boost/iterator/iterator_adaptor.hpp>
  13. #include <boost/range/concepts.hpp>
  14. #include <boost/range/iterator_range.hpp>
  15. #include <boost/test/test_tools.hpp>
  16. #include <boost/test/unit_test.hpp>
  17. #include <vector>
  18. namespace boost
  19. {
  20. typedef std::vector<int>::iterator iter_base;
  21. struct iter : boost::iterator_adaptor<iter, iter_base, int, boost::use_default, int> {}; // will be deduced as random-access traversal but input category
  22. typedef boost::iterator_range<iter> iter_range;
  23. namespace
  24. {
  25. // Ticket 6944 - Some Range concepts use the incorrect Iterator concept
  26. void test_ticket_6944()
  27. {
  28. BOOST_CONCEPT_ASSERT(( boost::RandomAccessRangeConcept<iter_range> ));
  29. }
  30. }
  31. }
  32. boost::unit_test::test_suite*
  33. init_unit_test_suite(int argc, char* argv[])
  34. {
  35. boost::unit_test::test_suite* test
  36. = BOOST_TEST_SUITE( "RangeTestSuite.ticket_6944" );
  37. test->add( BOOST_TEST_CASE( &boost::test_ticket_6944 ) );
  38. return test;
  39. }