+BOOST_AUTO_TEST_CASE( reverse_iterators_test )
+{
+ buffer::value_type a[] = { 56, 123, 253 };
+ buffer b(a, a + 3);
+ BOOST_CHECK_NE(b.rbegin(), b.rend());
+ BOOST_CHECK_LT(b.rbegin(), b.rend());
+ buffer::reverse_iterator i = b.rbegin();
+ BOOST_CHECK_EQUAL(*i, 253);
+ i++;
+ BOOST_CHECK_EQUAL(*i, 123);
+ ++i;
+ BOOST_CHECK_EQUAL(*i, 56);
+ i += 1;
+ BOOST_CHECK_EQUAL(i, b.rend());
+ i--;
+ BOOST_CHECK_EQUAL(*i, 56);
+ --i;
+ BOOST_CHECK_EQUAL(*i, 123);
+ i -= 1;
+ BOOST_CHECK_EQUAL(*i, 253);
+ i++;
+ BOOST_CHECK_EQUAL(*(i + 1), 56);
+ BOOST_CHECK_EQUAL(*(i - 1), 253);
+ BOOST_CHECK_EQUAL(i - 1, b.rbegin());
+ BOOST_CHECK_EQUAL(i + 2, b.rend());
+ BOOST_CHECK_EQUAL(i - b.rbegin(), 1);
+ *i = 77;
+ BOOST_CHECK_EQUAL(*i, 77);
+ BOOST_CHECK_EQUAL(*(b.rbegin() + 1), 77);
+}
+