diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2010-11-02 14:20:37 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-11-03 10:50:48 (GMT) |
commit | d12681a4cf1227d0e92fc7cf12aa3977e6ffe3fe (patch) | |
tree | 32306cd47731503f85a3d88881a5e28901506432 /tests/auto/qhash | |
parent | 9ff533aa0ddf944b73b0c29193fc9936c644142e (diff) | |
download | Qt-d12681a4cf1227d0e92fc7cf12aa3977e6ffe3fe.zip Qt-d12681a4cf1227d0e92fc7cf12aa3977e6ffe3fe.tar.gz Qt-d12681a4cf1227d0e92fc7cf12aa3977e6ffe3fe.tar.bz2 |
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/qhash')
-rw-r--r-- | tests/auto/qhash/tst_qhash.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/qhash/tst_qhash.cpp b/tests/auto/qhash/tst_qhash.cpp index 3a7b54a..ea6e010 100644 --- a/tests/auto/qhash/tst_qhash.cpp +++ b/tests/auto/qhash/tst_qhash.cpp @@ -60,6 +60,7 @@ private slots: void erase(); void key(); + void swap(); void count(); // copied from tst_QMap void clear(); // copied from tst_QMap void empty(); // copied from tst_QMap @@ -553,6 +554,16 @@ void tst_QHash::key() } } +void tst_QHash::swap() +{ + QHash<int,QString> h1, h2; + h1[0] = "h1[0]"; + h2[1] = "h2[1]"; + h1.swap(h2); + QCOMPARE(h1.value(1),QLatin1String("h2[1]")); + QCOMPARE(h2.value(0),QLatin1String("h1[0]")); +} + // copied from tst_QMap void tst_QHash::clear() { |