summaryrefslogtreecommitdiff
path: root/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2010-11-02 15:20:37 +0100
committerOlivier Goffart <olivier.goffart@nokia.com>2010-11-03 11:50:48 +0100
commitd12681a4cf1227d0e92fc7cf12aa3977e6ffe3fe (patch)
tree32306cd47731503f85a3d88881a5e28901506432 /tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp
parent9ff533aa0ddf944b73b0c29193fc9936c644142e (diff)
downloadqt4-tools-d12681a4cf1227d0e92fc7cf12aa3977e6ffe3fe.tar.gz
Containers: add member-swap
Member-swap is required by the STL Sequence concept, but is also needed to write exception-safe code. Merge-request: 871 Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com>
Diffstat (limited to 'tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp')
-rw-r--r--tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp b/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp
index f64e815ada..568ba06c28 100644
--- a/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp
+++ b/tests/auto/qcontiguouscache/tst_qcontiguouscache.cpp
@@ -55,6 +55,8 @@ public:
virtual ~tst_QContiguousCache() {}
private slots:
void empty();
+ void swap();
+
void append_data();
void append();
@@ -99,6 +101,17 @@ void tst_QContiguousCache::empty()
QCOMPARE(c.capacity(), 10);
}
+void tst_QContiguousCache::swap()
+{
+ QContiguousCache<int> c1(10), c2(100);
+ c1.append(1);
+ c1.swap(c2);
+ QCOMPARE(c1.capacity(), 100);
+ QCOMPARE(c1.count(), 0 );
+ QCOMPARE(c2.capacity(), 10 );
+ QCOMPARE(c2.count(), 1 );
+}
+
void tst_QContiguousCache::append_data()
{
QTest::addColumn<int>("start");