summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qvarlengtharray
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-04-05 16:57:49 +0000
commitcc164f9ac73cd44a0ab082af78dccde8057154dc (patch)
treeb7cadf79e0b274534fbdb728fcc128b6f7c9391b /tests/auto/corelib/tools/qvarlengtharray
parentf276dd5b7f8b45201949906c3167ff43ecb2caf4 (diff)
QVarLengthArray: add {const_,reverse_iterator}, {c,}r{begin,end}()
[ChangeLog][QtCore][QVarLengthArray] Added rbegin(), crbegin(), rend(), crend(), and reverse_iterator and const_reverse_iterator typedefs. Task-number: QTBUG-25919 Change-Id: Ifda5d420802a3594c3181f54036279f16a7da16e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/tools/qvarlengtharray')
-rw-r--r--tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
index 60f3009849..449fefbaa2 100644
--- a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
+++ b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp
@@ -47,6 +47,7 @@ private slots:
void appendCausingRealloc();
void resize();
void realloc();
+ void reverseIterators();
void count();
void first();
void last();
@@ -563,6 +564,21 @@ void tst_QVarLengthArray::realloc()
QVERIFY(reallocTestProceed);
}
+void tst_QVarLengthArray::reverseIterators()
+{
+ QVarLengthArray<int> v;
+ v << 1 << 2 << 3 << 4;
+ QVarLengthArray<int> vr = v;
+ std::reverse(vr.begin(), vr.end());
+ const QVarLengthArray<int> &cvr = vr;
+ QVERIFY(std::equal(v.begin(), v.end(), vr.rbegin()));
+ QVERIFY(std::equal(v.begin(), v.end(), vr.crbegin()));
+ QVERIFY(std::equal(v.begin(), v.end(), cvr.rbegin()));
+ QVERIFY(std::equal(vr.rbegin(), vr.rend(), v.begin()));
+ QVERIFY(std::equal(vr.crbegin(), vr.crend(), v.begin()));
+ QVERIFY(std::equal(cvr.rbegin(), cvr.rend(), v.begin()));
+}
+
void tst_QVarLengthArray::count()
{
// tests size(), count() and length(), since they're the same thing