summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-03-31 00:14:24 +0200
committerMarc Mutz <marc.mutz@kdab.com>2015-07-07 05:22:08 +0000
commitf405352fee01c167226990a5b871c515942f7938 (patch)
tree3568130614707c0344b4420573fccf3dcd83835b /tests
parent92d5733c780f7151ec99da4ad604f53f9438d26f (diff)
QByteArray: add {const_,reverse_iterator}, {c,}r{begin,end}()
Had to mark {,c,const}{begin,end}() inline, since they are, and mingw complains about inconsistent dllimport attributes. [ChangeLog][QtCore][QByteArray] Added rbegin(), crbegin(), rend(), crend(), and reverse_iterator and const_reverse_iterator typedefs. Task-number: QTBUG-25919 Change-Id: Id5aefb52635f029305135afcd99db0b036a7af82 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
index 410b34e894..f942eab800 100644
--- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
@@ -67,6 +67,7 @@ private slots:
void endsWith_data();
void endsWith();
void endsWith_char();
+ void reverseIterators();
void split_data();
void split();
void base64_data();
@@ -540,6 +541,20 @@ void tst_QByteArray::endsWith_char()
QVERIFY(!QByteArray().endsWith('\0'));
}
+void tst_QByteArray::reverseIterators()
+{
+ QByteArray s = "1234";
+ QByteArray sr = s;
+ std::reverse(sr.begin(), sr.end());
+ const QByteArray &csr = sr;
+ QVERIFY(std::equal(s.begin(), s.end(), sr.rbegin()));
+ QVERIFY(std::equal(s.begin(), s.end(), sr.crbegin()));
+ QVERIFY(std::equal(s.begin(), s.end(), csr.rbegin()));
+ QVERIFY(std::equal(sr.rbegin(), sr.rend(), s.begin()));
+ QVERIFY(std::equal(sr.crbegin(), sr.crend(), s.begin()));
+ QVERIFY(std::equal(csr.rbegin(), csr.rend(), s.begin()));
+}
+
void tst_QByteArray::split_data()
{
QTest::addColumn<QByteArray>("sample");