diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2021-08-18 11:48:29 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2021-08-30 19:21:08 +0200 |
commit | 9004a2412ba1f9976c2c61f01223dff852208c42 (patch) | |
tree | f06abeec8b9cc66abf0e66cc9048c7a0ed02a360 /tests/benchmarks/corelib/tools | |
parent | c2a6749af795386495b275684418d083410fa1e4 (diff) |
Standardise layout and naming in corelib benchmarks
Make file names match CMake's test names (and those follow dir-name)
and class names follow tst_ClassName pattern when testing
ClassName. Purge comments about the qmake configs the CMakeLists.txt
are generated from. Purge empty constructors and init/cleanup methods
of classes. Fix petty coding style violations.
Add qdir/tree/, qurl, qbench and qset benchmarks to their parent directories'
lists of subdirs. Fix unused return error from qurl benchmark.
Change-Id: Ifc15a3a46e71cf82ad0637753517e0df34049763
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/benchmarks/corelib/tools')
23 files changed, 73 insertions, 102 deletions
diff --git a/tests/benchmarks/corelib/tools/CMakeLists.txt b/tests/benchmarks/corelib/tools/CMakeLists.txt index 805aa92229..25cc02ad1d 100644 --- a/tests/benchmarks/corelib/tools/CMakeLists.txt +++ b/tests/benchmarks/corelib/tools/CMakeLists.txt @@ -1,13 +1,13 @@ -# Generated from tools.pro. - add_subdirectory(containers-associative) add_subdirectory(containers-sequential) add_subdirectory(qcontiguouscache) add_subdirectory(qcryptographichash) +add_subdirectory(qhash) add_subdirectory(qlist) add_subdirectory(qmap) add_subdirectory(qrect) add_subdirectory(qringbuffer) +add_subdirectory(qset) add_subdirectory(qsharedpointer) add_subdirectory(qstack) add_subdirectory(qvector) diff --git a/tests/benchmarks/corelib/tools/containers-associative/CMakeLists.txt b/tests/benchmarks/corelib/tools/containers-associative/CMakeLists.txt index 1e653fa98d..50bf8a0c0f 100644 --- a/tests/benchmarks/corelib/tools/containers-associative/CMakeLists.txt +++ b/tests/benchmarks/corelib/tools/containers-associative/CMakeLists.txt @@ -1,15 +1,10 @@ -# Generated from containers-associative.pro. - ##################################################################### -## tst_bench_containers-associative Binary: +## tst_bench_containers_associative Binary: ##################################################################### -qt_internal_add_benchmark(tst_bench_containers-associative +qt_internal_add_benchmark(tst_bench_containers_associative SOURCES - main.cpp + tst_bench_containers_associative.cpp PUBLIC_LIBRARIES Qt::Test ) - -#### Keys ignored in scope 1:.:.:containers-associative.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/benchmarks/corelib/tools/containers-associative/main.cpp b/tests/benchmarks/corelib/tools/containers-associative/tst_bench_containers_associative.cpp index 555d4bf843..6bab99cad7 100644 --- a/tests/benchmarks/corelib/tools/containers-associative/main.cpp +++ b/tests/benchmarks/corelib/tools/containers-associative/tst_bench_containers_associative.cpp @@ -127,4 +127,5 @@ void tst_associative_containers::lookup() } QTEST_MAIN(tst_associative_containers) -#include "main.moc" + +#include "tst_bench_containers_associative.moc" diff --git a/tests/benchmarks/corelib/tools/containers-sequential/CMakeLists.txt b/tests/benchmarks/corelib/tools/containers-sequential/CMakeLists.txt index f8ebc69c29..2e6d26e343 100644 --- a/tests/benchmarks/corelib/tools/containers-sequential/CMakeLists.txt +++ b/tests/benchmarks/corelib/tools/containers-sequential/CMakeLists.txt @@ -1,15 +1,10 @@ -# Generated from containers-sequential.pro. - ##################################################################### ## tst_bench_containers-sequential Binary: ##################################################################### -qt_internal_add_benchmark(tst_bench_containers-sequential +qt_internal_add_benchmark(tst_bench_containers_sequential SOURCES - main.cpp + tst_bench_containers_sequential.cpp PUBLIC_LIBRARIES Qt::Test ) - -#### Keys ignored in scope 1:.:.:containers-sequential.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/benchmarks/corelib/tools/containers-sequential/main.cpp b/tests/benchmarks/corelib/tools/containers-sequential/tst_bench_containers_sequential.cpp index 1bb1a02a24..55d4cc72df 100644 --- a/tests/benchmarks/corelib/tools/containers-sequential/main.cpp +++ b/tests/benchmarks/corelib/tools/containers-sequential/tst_bench_containers_sequential.cpp @@ -244,4 +244,5 @@ void tst_vector_vs_std::lookup_Large() } QTEST_MAIN(tst_vector_vs_std) -#include "main.moc" + +#include "tst_bench_containers_sequential.moc" diff --git a/tests/benchmarks/corelib/tools/qcontiguouscache/CMakeLists.txt b/tests/benchmarks/corelib/tools/qcontiguouscache/CMakeLists.txt index e683d60de2..29366ecf36 100644 --- a/tests/benchmarks/corelib/tools/qcontiguouscache/CMakeLists.txt +++ b/tests/benchmarks/corelib/tools/qcontiguouscache/CMakeLists.txt @@ -1,12 +1,10 @@ -# Generated from qcontiguouscache.pro. - ##################################################################### ## tst_bench_qcontiguouscache Binary: ##################################################################### qt_internal_add_benchmark(tst_bench_qcontiguouscache SOURCES - main.cpp + tst_bench_qcontiguouscache.cpp PUBLIC_LIBRARIES Qt::Test ) diff --git a/tests/benchmarks/corelib/tools/qcontiguouscache/main.cpp b/tests/benchmarks/corelib/tools/qcontiguouscache/tst_bench_qcontiguouscache.cpp index 368c8b66bb..bc235b6747 100644 --- a/tests/benchmarks/corelib/tools/qcontiguouscache/main.cpp +++ b/tests/benchmarks/corelib/tools/qcontiguouscache/tst_bench_qcontiguouscache.cpp @@ -46,8 +46,6 @@ private slots: void contiguousCacheBenchmark(); }; -QTEST_MAIN(tst_QContiguousCache) - void tst_QContiguousCache::asScrollingList() { int i; @@ -176,4 +174,6 @@ void tst_QContiguousCache::contiguousCacheBenchmark() } } -#include "main.moc" +QTEST_MAIN(tst_QContiguousCache) + +#include "tst_bench_qcontiguouscache.moc" diff --git a/tests/benchmarks/corelib/tools/qcryptographichash/CMakeLists.txt b/tests/benchmarks/corelib/tools/qcryptographichash/CMakeLists.txt index 2ca8e683e1..e9d539eb1a 100644 --- a/tests/benchmarks/corelib/tools/qcryptographichash/CMakeLists.txt +++ b/tests/benchmarks/corelib/tools/qcryptographichash/CMakeLists.txt @@ -1,12 +1,10 @@ -# Generated from qcryptographichash.pro. - ##################################################################### ## tst_bench_qcryptographichash Binary: ##################################################################### qt_internal_add_benchmark(tst_bench_qcryptographichash SOURCES - main.cpp + tst_bench_qcryptographichash.cpp PUBLIC_LIBRARIES Qt::Test ) diff --git a/tests/benchmarks/corelib/tools/qcryptographichash/main.cpp b/tests/benchmarks/corelib/tools/qcryptographichash/tst_bench_qcryptographichash.cpp index 1f0a7373bb..bff3ddbc26 100644 --- a/tests/benchmarks/corelib/tools/qcryptographichash/main.cpp +++ b/tests/benchmarks/corelib/tools/qcryptographichash/tst_bench_qcryptographichash.cpp @@ -35,13 +35,13 @@ #include <time.h> -class tst_bench_QCryptographicHash : public QObject +class tst_QCryptographicHash : public QObject { Q_OBJECT QByteArray blockOfData; public: - tst_bench_QCryptographicHash(); + tst_QCryptographicHash(); private Q_SLOTS: void hash_data(); @@ -109,7 +109,7 @@ const char *algoname(int i) return nullptr; } -tst_bench_QCryptographicHash::tst_bench_QCryptographicHash() +tst_QCryptographicHash::tst_QCryptographicHash() : blockOfData(MaxBlockSize, Qt::Uninitialized) { #ifdef Q_OS_UNIX @@ -124,7 +124,7 @@ tst_bench_QCryptographicHash::tst_bench_QCryptographicHash() } } -void tst_bench_QCryptographicHash::hash_data() +void tst_QCryptographicHash::hash_data() { QTest::addColumn<int>("algorithm"); QTest::addColumn<QByteArray>("data"); @@ -139,7 +139,7 @@ void tst_bench_QCryptographicHash::hash_data() } } -void tst_bench_QCryptographicHash::hash() +void tst_QCryptographicHash::hash() { QFETCH(int, algorithm); QFETCH(QByteArray, data); @@ -150,7 +150,7 @@ void tst_bench_QCryptographicHash::hash() } } -void tst_bench_QCryptographicHash::addData() +void tst_QCryptographicHash::addData() { QFETCH(int, algorithm); QFETCH(QByteArray, data); @@ -164,7 +164,7 @@ void tst_bench_QCryptographicHash::addData() } } -void tst_bench_QCryptographicHash::addDataChunked() +void tst_QCryptographicHash::addDataChunked() { QFETCH(int, algorithm); QFETCH(QByteArray, data); @@ -183,6 +183,6 @@ void tst_bench_QCryptographicHash::addDataChunked() } } -QTEST_APPLESS_MAIN(tst_bench_QCryptographicHash) +QTEST_APPLESS_MAIN(tst_QCryptographicHash) -#include "main.moc" +#include "tst_bench_qcryptographichash.moc" diff --git a/tests/benchmarks/corelib/tools/qhash/CMakeLists.txt b/tests/benchmarks/corelib/tools/qhash/CMakeLists.txt index 5286484b0c..437ea285e8 100644 --- a/tests/benchmarks/corelib/tools/qhash/CMakeLists.txt +++ b/tests/benchmarks/corelib/tools/qhash/CMakeLists.txt @@ -1,12 +1,10 @@ -# Generated from qhash.pro. - ##################################################################### -## tst_hash Binary: +## tst_bench_qhash Binary: ##################################################################### -qt_internal_add_benchmark(tst_hash +qt_internal_add_benchmark(tst_bench_qhash SOURCES - main.cpp + tst_bench_qhash.cpp outofline.cpp INCLUDE_DIRECTORIES . diff --git a/tests/benchmarks/corelib/tools/qhash/outofline.cpp b/tests/benchmarks/corelib/tools/qhash/outofline.cpp index 4e449e76b4..795b2cbdc6 100644 --- a/tests/benchmarks/corelib/tools/qhash/outofline.cpp +++ b/tests/benchmarks/corelib/tools/qhash/outofline.cpp @@ -26,7 +26,7 @@ ** ****************************************************************************/ -#include "main.h" +#include "tst_bench_qhash.h" QT_BEGIN_NAMESPACE diff --git a/tests/benchmarks/corelib/tools/qhash/main.cpp b/tests/benchmarks/corelib/tools/qhash/tst_bench_qhash.cpp index f9b1624fcc..30778a0c8c 100644 --- a/tests/benchmarks/corelib/tools/qhash/main.cpp +++ b/tests/benchmarks/corelib/tools/qhash/tst_bench_qhash.cpp @@ -27,7 +27,7 @@ ** ****************************************************************************/ -#include "main.h" +#include "tst_bench_qhash.h" #include <QFile> #include <QHash> @@ -78,7 +78,8 @@ private: void tst_QHash::initTestCase() { - // small list of file paths + // small list of strings (that happen to look like file paths produced long + // ago by cd ../.. && find . -print, but that's irrelevant). QFile smallPathsData(QFINDTESTDATA("paths_small_data.txt")); QVERIFY(smallPathsData.open(QIODevice::ReadOnly)); smallFilePaths = QString::fromLatin1(smallPathsData.readAll()).split(QLatin1Char('\n')); @@ -170,4 +171,4 @@ template <typename String> void tst_QHash::hashing_template() QTEST_MAIN(tst_QHash) -#include "main.moc" +#include "tst_bench_qhash.moc" diff --git a/tests/benchmarks/corelib/tools/qhash/main.h b/tests/benchmarks/corelib/tools/qhash/tst_bench_qhash.h index eca4b61d58..eca4b61d58 100644 --- a/tests/benchmarks/corelib/tools/qhash/main.h +++ b/tests/benchmarks/corelib/tools/qhash/tst_bench_qhash.h diff --git a/tests/benchmarks/corelib/tools/qlist/CMakeLists.txt b/tests/benchmarks/corelib/tools/qlist/CMakeLists.txt index 46ca1c8514..6c9a96399f 100644 --- a/tests/benchmarks/corelib/tools/qlist/CMakeLists.txt +++ b/tests/benchmarks/corelib/tools/qlist/CMakeLists.txt @@ -1,12 +1,10 @@ -# Generated from qlist.pro. - ##################################################################### ## tst_bench_qlist Binary: ##################################################################### qt_internal_add_benchmark(tst_bench_qlist SOURCES - main.cpp + tst_bench_qlist.cpp PUBLIC_LIBRARIES Qt::Test ) diff --git a/tests/benchmarks/corelib/tools/qlist/main.cpp b/tests/benchmarks/corelib/tools/qlist/tst_bench_qlist.cpp index 1f2f8553fe..d83e6eb61c 100644 --- a/tests/benchmarks/corelib/tools/qlist/main.cpp +++ b/tests/benchmarks/corelib/tools/qlist/tst_bench_qlist.cpp @@ -498,4 +498,4 @@ void tst_QList::removeFirstSpecial_impl() const QTEST_APPLESS_MAIN(tst_QList) -#include "main.moc" +#include "tst_bench_qlist.moc" diff --git a/tests/benchmarks/corelib/tools/qrect/CMakeLists.txt b/tests/benchmarks/corelib/tools/qrect/CMakeLists.txt index 30234c7055..e3ce41f7be 100644 --- a/tests/benchmarks/corelib/tools/qrect/CMakeLists.txt +++ b/tests/benchmarks/corelib/tools/qrect/CMakeLists.txt @@ -1,15 +1,10 @@ -# Generated from qrect.pro. - ##################################################################### ## tst_bench_qrect Binary: ##################################################################### qt_internal_add_benchmark(tst_bench_qrect SOURCES - main.cpp + tst_bench_qrect.cpp PUBLIC_LIBRARIES Qt::Test ) - -#### Keys ignored in scope 1:.:.:qrect.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/benchmarks/corelib/tools/qrect/main.cpp b/tests/benchmarks/corelib/tools/qrect/tst_bench_qrect.cpp index 7ddf17845c..8850ede4f6 100644 --- a/tests/benchmarks/corelib/tools/qrect/main.cpp +++ b/tests/benchmarks/corelib/tools/qrect/tst_bench_qrect.cpp @@ -30,7 +30,7 @@ #include <QDebug> #include <qtest.h> -class tst_qrect : public QObject +class tst_QRect : public QObject { Q_OBJECT private slots: @@ -159,12 +159,12 @@ static void addRectPointData(bool includeProperArg = false) } } -void tst_qrect::contains_point_data() +void tst_QRect::contains_point_data() { addRectPointData(true); } -void tst_qrect::contains_point() +void tst_QRect::contains_point() { QFETCH(QRectF, rf); QFETCH(QPointF, pf); @@ -176,12 +176,12 @@ void tst_qrect::contains_point() } } -void tst_qrect::contains_rect_data() +void tst_QRect::contains_rect_data() { addRectRectData(true); } -void tst_qrect::contains_rect() +void tst_QRect::contains_rect() { QFETCH(QRectF, rf1); QFETCH(QRectF, rf2); @@ -193,12 +193,12 @@ void tst_qrect::contains_rect() } } -void tst_qrect::intersects_data() +void tst_QRect::intersects_data() { addRectRectData(); } -void tst_qrect::intersects() +void tst_QRect::intersects() { QFETCH(QRectF, rf1); QFETCH(QRectF, rf2); @@ -209,12 +209,12 @@ void tst_qrect::intersects() } } -void tst_qrect::intersected_data() +void tst_QRect::intersected_data() { addRectRectData(); } -void tst_qrect::intersected() +void tst_QRect::intersected() { QFETCH(QRectF, rf1); QFETCH(QRectF, rf2); @@ -225,12 +225,12 @@ void tst_qrect::intersected() } } -void tst_qrect::united_data() +void tst_QRect::united_data() { addRectRectData(); } -void tst_qrect::united() +void tst_QRect::united() { QFETCH(QRectF, rf1); QFETCH(QRectF, rf2); @@ -241,12 +241,12 @@ void tst_qrect::united() } } -void tst_qrect::contains_point_f_data() +void tst_QRect::contains_point_f_data() { addRectPointData(); } -void tst_qrect::contains_point_f() +void tst_QRect::contains_point_f() { QFETCH(QRectF, rf); QFETCH(QPointF, pf); @@ -255,12 +255,12 @@ void tst_qrect::contains_point_f() } } -void tst_qrect::contains_rect_f_data() +void tst_QRect::contains_rect_f_data() { addRectRectData(); } -void tst_qrect::contains_rect_f() +void tst_QRect::contains_rect_f() { QFETCH(QRectF, rf1); QFETCH(QRectF, rf2); @@ -269,12 +269,12 @@ void tst_qrect::contains_rect_f() } } -void tst_qrect::intersects_f_data() +void tst_QRect::intersects_f_data() { addRectRectData(); } -void tst_qrect::intersects_f() +void tst_QRect::intersects_f() { QFETCH(QRectF, rf1); QFETCH(QRectF, rf2); @@ -283,12 +283,12 @@ void tst_qrect::intersects_f() } } -void tst_qrect::intersected_f_data() +void tst_QRect::intersected_f_data() { addRectRectData(); } -void tst_qrect::intersected_f() +void tst_QRect::intersected_f() { QFETCH(QRectF, rf1); QFETCH(QRectF, rf2); @@ -297,12 +297,12 @@ void tst_qrect::intersected_f() } } -void tst_qrect::united_f_data() +void tst_QRect::united_f_data() { addRectRectData(); } -void tst_qrect::united_f() +void tst_QRect::united_f() { QFETCH(QRectF, rf1); QFETCH(QRectF, rf2); @@ -311,6 +311,6 @@ void tst_qrect::united_f() } } -QTEST_MAIN(tst_qrect) +QTEST_MAIN(tst_QRect) -#include "main.moc" +#include "tst_bench_qrect.moc" diff --git a/tests/benchmarks/corelib/tools/qringbuffer/CMakeLists.txt b/tests/benchmarks/corelib/tools/qringbuffer/CMakeLists.txt index 63128f5f95..23a2c990de 100644 --- a/tests/benchmarks/corelib/tools/qringbuffer/CMakeLists.txt +++ b/tests/benchmarks/corelib/tools/qringbuffer/CMakeLists.txt @@ -1,16 +1,11 @@ -# Generated from qringbuffer.pro. - ##################################################################### ## tst_bench_qringbuffer Binary: ##################################################################### qt_internal_add_benchmark(tst_bench_qringbuffer SOURCES - main.cpp + tst_bench_qringbuffer.cpp PUBLIC_LIBRARIES Qt::CorePrivate Qt::Test ) - -#### Keys ignored in scope 1:.:.:qringbuffer.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/benchmarks/corelib/tools/qringbuffer/main.cpp b/tests/benchmarks/corelib/tools/qringbuffer/tst_bench_qringbuffer.cpp index fad30a4e34..ab75688749 100644 --- a/tests/benchmarks/corelib/tools/qringbuffer/main.cpp +++ b/tests/benchmarks/corelib/tools/qringbuffer/tst_bench_qringbuffer.cpp @@ -31,7 +31,7 @@ #include <qtest.h> -class tst_qringbuffer : public QObject +class tst_QRingBuffer : public QObject { Q_OBJECT private slots: @@ -39,7 +39,7 @@ private slots: void free(); }; -void tst_qringbuffer::reserveAndRead() +void tst_QRingBuffer::reserveAndRead() { QRingBuffer ringBuffer; QBENCHMARK { @@ -51,7 +51,7 @@ void tst_qringbuffer::reserveAndRead() } } -void tst_qringbuffer::free() +void tst_QRingBuffer::free() { QRingBuffer ringBuffer; QBENCHMARK { @@ -66,6 +66,6 @@ void tst_qringbuffer::free() } } -QTEST_MAIN(tst_qringbuffer) +QTEST_MAIN(tst_QRingBuffer) -#include "main.moc" +#include "tst_bench_qringbuffer.moc" diff --git a/tests/benchmarks/corelib/tools/qset/CMakeLists.txt b/tests/benchmarks/corelib/tools/qset/CMakeLists.txt index 00fd088776..844226c833 100644 --- a/tests/benchmarks/corelib/tools/qset/CMakeLists.txt +++ b/tests/benchmarks/corelib/tools/qset/CMakeLists.txt @@ -1,12 +1,10 @@ -# Generated from qset.pro. - ##################################################################### -## tst_qset Binary: +## tst_bench_qset Binary: ##################################################################### -qt_internal_add_benchmark(tst_qset +qt_internal_add_benchmark(tst_bench_qset SOURCES - main.cpp + tst_bench_qset.cpp PUBLIC_LIBRARIES Qt::Test ) diff --git a/tests/benchmarks/corelib/tools/qset/main.cpp b/tests/benchmarks/corelib/tools/qset/tst_bench_qset.cpp index f6c40ec160..4d873f8e39 100644 --- a/tests/benchmarks/corelib/tools/qset/main.cpp +++ b/tests/benchmarks/corelib/tools/qset/tst_bench_qset.cpp @@ -125,4 +125,4 @@ void tst_QSet::intersect_complexType() QTEST_MAIN(tst_QSet) -#include "main.moc" +#include "tst_bench_qset.moc" diff --git a/tests/benchmarks/corelib/tools/qstack/CMakeLists.txt b/tests/benchmarks/corelib/tools/qstack/CMakeLists.txt index 4526af60db..9cd09a0699 100644 --- a/tests/benchmarks/corelib/tools/qstack/CMakeLists.txt +++ b/tests/benchmarks/corelib/tools/qstack/CMakeLists.txt @@ -1,12 +1,10 @@ -# Generated from qstack.pro. - ##################################################################### -## tst_bench_stack Binary: +## tst_bench_qstack Binary: ##################################################################### -qt_internal_add_benchmark(tst_bench_stack +qt_internal_add_benchmark(tst_bench_qstack SOURCES - main.cpp + tst_bench_qstack.cpp PUBLIC_LIBRARIES Qt::CorePrivate Qt::Test diff --git a/tests/benchmarks/corelib/tools/qstack/main.cpp b/tests/benchmarks/corelib/tools/qstack/tst_bench_qstack.cpp index c69e5c3ed8..2f17895f61 100644 --- a/tests/benchmarks/corelib/tools/qstack/main.cpp +++ b/tests/benchmarks/corelib/tools/qstack/tst_bench_qstack.cpp @@ -81,4 +81,4 @@ void tst_QStack::qstack_pushpopone() QTEST_MAIN(tst_QStack) -#include "main.moc" +#include "tst_bench_qstack.moc" |