diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-10-29 11:16:43 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-10-29 11:16:43 (GMT) |
commit | 28c004a2750205750735ccb7a46549c376673434 (patch) | |
tree | 34d73a7d5a058c531bd30eba4c3d67be23272cc5 /tests | |
parent | 8943b44c38ee6244c4a5b190c2b35879b1921843 (diff) | |
parent | 4bfd68ccbda50fa3336d6ee6875d87b1b308b870 (diff) | |
download | Qt-28c004a2750205750735ccb7a46549c376673434.zip Qt-28c004a2750205750735ccb7a46549c376673434.tar.gz Qt-28c004a2750205750735ccb7a46549c376673434.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
qSwap: use std::swap as implementation, and specialize std::swap for our container
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qalgorithms/tst_qalgorithms.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qalgorithms/tst_qalgorithms.cpp b/tests/auto/qalgorithms/tst_qalgorithms.cpp index 690bbbd..17e6c04 100644 --- a/tests/auto/qalgorithms/tst_qalgorithms.cpp +++ b/tests/auto/qalgorithms/tst_qalgorithms.cpp @@ -81,6 +81,7 @@ private slots: void test_qBinaryFind(); void qBinaryFindOneEntry(); void swap(); + void swap2(); void sortEmptyList(); void sortedList(); void sortAPItest(); @@ -521,6 +522,28 @@ void tst_QAlgorithms::swap() } } +namespace SwapTest { + struct ST { int i; int j; }; + void swap(ST &a, ST &b) { + a.i = b.j; + b.i = a.j; + } +} + +void tst_QAlgorithms::swap2() +{ + { +#ifndef QT_NO_SQL + //check the namespace lookup works correctly + SwapTest::ST a = { 45, 65 }; + SwapTest::ST b = { 48, 68 }; + qSwap(a, b); + QCOMPARE(a.i, 68); + QCOMPARE(b.i, 65); +#endif + } +} + void tst_QAlgorithms::sortEmptyList() { // Only test if it crashes |