Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r72108 - trunk/libs/range/test/adaptor_test
From: neil_at_[hidden]
Date: 2011-05-22 18:15:15


Author: neilgroves
Date: 2011-05-22 18:15:14 EDT (Sun, 22 May 2011)
New Revision: 72108
URL: http://svn.boost.org/trac/boost/changeset/72108

Log:
[boost][range] - Ticket 5236 - Improved test coverage to ensure that the result for a random access strided range is consistent with that of a bidirectional strided range.
Text files modified:
   trunk/libs/range/test/adaptor_test/strided.cpp | 19 ++++++++++++++++---
   1 files changed, 16 insertions(+), 3 deletions(-)

Modified: trunk/libs/range/test/adaptor_test/strided.cpp
==============================================================================
--- trunk/libs/range/test/adaptor_test/strided.cpp (original)
+++ trunk/libs/range/test/adaptor_test/strided.cpp 2011-05-22 18:15:14 EDT (Sun, 22 May 2011)
@@ -252,14 +252,19 @@
         }
 
         template<typename Range>
- void strided_test_ticket_5236_check(const Range& rng)
+ void strided_test_ticket_5236_check_bidirectional(const Range& rng)
         {
             BOOST_CHECK_EQUAL( boost::distance(rng), 1 );
             BOOST_CHECK_EQUAL( std::distance(boost::begin(rng), boost::prior(boost::end(rng))), 0 );
-
+ }
+
+ template<typename Range>
+ void strided_test_ticket_5236_check(const Range& rng)
+ {
+ strided_test_ticket_5236_check_bidirectional(rng);
+
             typename boost::range_iterator<const Range>::type it = boost::end(rng);
             it = it - 1;
-
             BOOST_CHECK_EQUAL( std::distance(boost::begin(rng), it), 0 );
         }
         
@@ -268,7 +273,15 @@
             std::vector<int> v;
             v.push_back(1);
             strided_test_ticket_5236_check( v | boost::adaptors::strided(2) );
+
+ // Ensure that there is consistency between the random-access implementation
+ // and the bidirectional.
+
+ std::list<int> l;
+ l.push_back(1);
+ strided_test_ticket_5236_check_bidirectional( l | boost::adaptors::strided(2) );
         }
+
     }
 }
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk