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/io | |
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/io')
22 files changed, 108 insertions, 148 deletions
diff --git a/tests/benchmarks/corelib/io/CMakeLists.txt b/tests/benchmarks/corelib/io/CMakeLists.txt index 3419c4a28c..8d4b556abc 100644 --- a/tests/benchmarks/corelib/io/CMakeLists.txt +++ b/tests/benchmarks/corelib/io/CMakeLists.txt @@ -1,12 +1,11 @@ -# Generated from io.pro. - add_subdirectory(qdir) add_subdirectory(qdiriterator) add_subdirectory(qfile) add_subdirectory(qfileinfo) add_subdirectory(qiodevice) -add_subdirectory(qtemporaryfile) -add_subdirectory(qtextstream) if(QT_FEATURE_process) add_subdirectory(qprocess) endif() +add_subdirectory(qtemporaryfile) +add_subdirectory(qtextstream) +add_subdirectory(qurl) diff --git a/tests/benchmarks/corelib/io/qdir/10000/CMakeLists.txt b/tests/benchmarks/corelib/io/qdir/10000/CMakeLists.txt index e83c4e9acc..d1feaa5f18 100644 --- a/tests/benchmarks/corelib/io/qdir/10000/CMakeLists.txt +++ b/tests/benchmarks/corelib/io/qdir/10000/CMakeLists.txt @@ -1,15 +1,10 @@ -# Generated from 10000.pro. - ##################################################################### ## tst_bench_qdir_10000 Binary: ##################################################################### qt_internal_add_benchmark(tst_bench_qdir_10000 SOURCES - bench_qdir_10000.cpp + tst_bench_qdir_10000.cpp PUBLIC_LIBRARIES Qt::Test ) - -#### Keys ignored in scope 1:.:.:10000.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp b/tests/benchmarks/corelib/io/qdir/10000/tst_bench_qdir_10000.cpp index e02cfb3099..4ed1246a6c 100644 --- a/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp +++ b/tests/benchmarks/corelib/io/qdir/10000/tst_bench_qdir_10000.cpp @@ -38,10 +38,12 @@ # include <unistd.h> #endif -class bench_QDir_10000 : public QObject{ - Q_OBJECT +class tst_QDir_10000 : public QObject +{ + Q_OBJECT public slots: - void initTestCase() { + void initTestCase() + { QDir testdir = QDir::tempPath(); const QString subfolder_name = QLatin1String("test_speed"); @@ -53,7 +55,8 @@ public slots: file.open(QIODevice::WriteOnly); } } - void cleanupTestCase() { + void cleanupTestCase() + { { QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); testdir.setSorting(QDir::Unsorted); @@ -68,7 +71,8 @@ public slots: private slots: void baseline() {} - void sizeSpeed() { + void sizeSpeed() + { QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); QBENCHMARK { QFileInfoList fileInfoList = testdir.entryInfoList(QDir::Files, QDir::Unsorted); @@ -78,7 +82,8 @@ private slots: } } } - void sizeSpeedIterator() { + void sizeSpeedIterator() + { QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); QBENCHMARK { QDirIterator dit(testdir.path(), QDir::Files); @@ -90,7 +95,8 @@ private slots: } } - void sizeSpeedWithoutFilter() { + void sizeSpeedWithoutFilter() + { QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); QBENCHMARK { QFileInfoList fileInfoList = testdir.entryInfoList(QDir::NoFilter, QDir::Unsorted); @@ -99,7 +105,8 @@ private slots: } } } - void sizeSpeedWithoutFilterIterator() { + void sizeSpeedWithoutFilterIterator() + { QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); QBENCHMARK { QDirIterator dit(testdir.path()); @@ -111,7 +118,8 @@ private slots: } } - void sizeSpeedWithoutFileInfoList() { + void sizeSpeedWithoutFileInfoList() + { QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); testdir.setSorting(QDir::Unsorted); QBENCHMARK { @@ -123,7 +131,8 @@ private slots: } } - void iDontWantAnyStat() { + void iDontWantAnyStat() + { QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); testdir.setSorting(QDir::Unsorted); testdir.setFilter(QDir::AllEntries | QDir::System | QDir::Hidden); @@ -134,7 +143,8 @@ private slots: } } } - void iDontWantAnyStatIterator() { + void iDontWantAnyStatIterator() + { QBENCHMARK { QDirIterator dit(QDir::tempPath() + QLatin1String("/test_speed")); while (dit.hasNext()) { @@ -143,7 +153,8 @@ private slots: } } - void sorted_byTime() { + void sorted_byTime() + { QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); testdir.setSorting(QDir::Time); testdir.setFilter(QDir::AllEntries | QDir::System | QDir::Hidden); @@ -155,7 +166,8 @@ private slots: } } - void sizeSpeedWithoutFilterLowLevel() { + void sizeSpeedWithoutFilterLowLevel() + { QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); #ifdef Q_OS_WIN const wchar_t *dirpath = (wchar_t*)testdir.absolutePath().utf16(); @@ -194,5 +206,6 @@ private slots: } }; -QTEST_MAIN(bench_QDir_10000) -#include "bench_qdir_10000.moc" +QTEST_MAIN(tst_QDir_10000) + +#include "tst_bench_qdir_10000.moc" diff --git a/tests/benchmarks/corelib/io/qdir/CMakeLists.txt b/tests/benchmarks/corelib/io/qdir/CMakeLists.txt index 10185014fa..f1800fc0cd 100644 --- a/tests/benchmarks/corelib/io/qdir/CMakeLists.txt +++ b/tests/benchmarks/corelib/io/qdir/CMakeLists.txt @@ -1,3 +1,2 @@ -# Generated from qdir.pro. - add_subdirectory(10000) +add_subdirectory(tree) diff --git a/tests/benchmarks/corelib/io/qdir/tree/CMakeLists.txt b/tests/benchmarks/corelib/io/qdir/tree/CMakeLists.txt index c60bfcfdc3..32dea04edc 100644 --- a/tests/benchmarks/corelib/io/qdir/tree/CMakeLists.txt +++ b/tests/benchmarks/corelib/io/qdir/tree/CMakeLists.txt @@ -1,28 +1,22 @@ -# Generated from tree.pro. - ##################################################################### -## bench_qdir_tree Binary: +## tst_bench_qdir_tree Binary: ##################################################################### -qt_internal_add_benchmark(bench_qdir_tree +qt_internal_add_benchmark(tst_bench_qdir_tree SOURCES - bench_qdir_tree.cpp + tst_bench_qdir_tree.cpp PUBLIC_LIBRARIES Qt::Test ) # Resources: -set(bench_qdir_tree_resource_files +set(qdir_tree_resource_files "4.6.0-list.txt" ) -qt_internal_add_resource(bench_qdir_tree "bench_qdir_tree" +qt_internal_add_resource(tst_bench_qdir_tree "tst_bench_qdir_tree" PREFIX "/" FILES - ${bench_qdir_tree_resource_files} + ${qdir_tree_resource_files} ) - - -#### Keys ignored in scope 1:.:.:tree.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/benchmarks/corelib/io/qdir/tree/bench_qdir_tree.cpp b/tests/benchmarks/corelib/io/qdir/tree/tst_bench_qdir_tree.cpp index df16a7978a..d960cb41e2 100644 --- a/tests/benchmarks/corelib/io/qdir/tree/bench_qdir_tree.cpp +++ b/tests/benchmarks/corelib/io/qdir/tree/tst_bench_qdir_tree.cpp @@ -35,13 +35,13 @@ #include "../../../../../shared/filesystem.h" -class bench_QDir_tree +class tst_QDir_tree : public QObject { Q_OBJECT public: - bench_QDir_tree() + tst_QDir_tree() : prefix("test-tree/"), musicprefix(QLatin1String("music")), photoprefix(QLatin1String("photos")), @@ -221,5 +221,6 @@ private slots: } }; -QTEST_MAIN(bench_QDir_tree) -#include "bench_qdir_tree.moc" +QTEST_MAIN(tst_QDir_tree) + +#include "tst_bench_qdir_tree.moc" diff --git a/tests/benchmarks/corelib/io/qdir/tree/bench_qdir_tree.qrc b/tests/benchmarks/corelib/io/qdir/tree/tst_bench_qdir_tree.qrc index d57cb6c368..d57cb6c368 100644 --- a/tests/benchmarks/corelib/io/qdir/tree/bench_qdir_tree.qrc +++ b/tests/benchmarks/corelib/io/qdir/tree/tst_bench_qdir_tree.qrc diff --git a/tests/benchmarks/corelib/io/qdiriterator/CMakeLists.txt b/tests/benchmarks/corelib/io/qdiriterator/CMakeLists.txt index 8ba331a113..f250a9627a 100644 --- a/tests/benchmarks/corelib/io/qdiriterator/CMakeLists.txt +++ b/tests/benchmarks/corelib/io/qdiriterator/CMakeLists.txt @@ -1,12 +1,10 @@ -# Generated from qdiriterator.pro. - ##################################################################### ## tst_bench_qdiriterator Binary: ##################################################################### qt_internal_add_benchmark(tst_bench_qdiriterator SOURCES - main.cpp + tst_bench_qdiriterator.cpp qfilesystemiterator.cpp qfilesystemiterator.h PUBLIC_LIBRARIES Qt::Test diff --git a/tests/benchmarks/corelib/io/qdiriterator/main.cpp b/tests/benchmarks/corelib/io/qdiriterator/tst_bench_qdiriterator.cpp index acf1ede368..e22f235914 100644 --- a/tests/benchmarks/corelib/io/qdiriterator/main.cpp +++ b/tests/benchmarks/corelib/io/qdiriterator/tst_bench_qdiriterator.cpp @@ -48,7 +48,7 @@ #include <filesystem> #endif -class tst_qdiriterator : public QObject +class tst_QDirIterator : public QObject { Q_OBJECT @@ -64,7 +64,7 @@ private slots: void stdRecursiveDirectoryIterator_data() { data(); } }; -void tst_qdiriterator::data() +void tst_QDirIterator::data() { const char hereRelative[] = "tests/benchmarks/corelib/io/qdiriterator"; QByteArray dir(QT_TESTCASE_SOURCEDIR); @@ -155,7 +155,7 @@ static int posix_helper(const char *dirpath) #endif -void tst_qdiriterator::posix() +void tst_QDirIterator::posix() { QFETCH(QByteArray, dirpath); @@ -173,7 +173,7 @@ void tst_qdiriterator::posix() qDebug() << count; } -void tst_qdiriterator::diriterator() +void tst_QDirIterator::diriterator() { QFETCH(QByteArray, dirpath); @@ -203,7 +203,7 @@ void tst_qdiriterator::diriterator() qDebug() << count; } -void tst_qdiriterator::fsiterator() +void tst_QDirIterator::fsiterator() { QFETCH(QByteArray, dirpath); @@ -235,7 +235,7 @@ void tst_qdiriterator::fsiterator() qDebug() << count; } -void tst_qdiriterator::stdRecursiveDirectoryIterator() +void tst_QDirIterator::stdRecursiveDirectoryIterator() { #if QT_CONFIG(cxx17_filesystem) QFETCH(QByteArray, dirpath); @@ -257,6 +257,6 @@ void tst_qdiriterator::stdRecursiveDirectoryIterator() #endif } -QTEST_MAIN(tst_qdiriterator) +QTEST_MAIN(tst_QDirIterator) -#include "main.moc" +#include "tst_bench_qdiriterator.moc" diff --git a/tests/benchmarks/corelib/io/qfileinfo/CMakeLists.txt b/tests/benchmarks/corelib/io/qfileinfo/CMakeLists.txt index 1c088bf71a..8933b30cf3 100644 --- a/tests/benchmarks/corelib/io/qfileinfo/CMakeLists.txt +++ b/tests/benchmarks/corelib/io/qfileinfo/CMakeLists.txt @@ -1,16 +1,11 @@ -# Generated from qfileinfo.pro. - ##################################################################### ## tst_bench_qfileinfo Binary: ##################################################################### qt_internal_add_benchmark(tst_bench_qfileinfo SOURCES - main.cpp + tst_bench_qfileinfo.cpp PUBLIC_LIBRARIES Qt::CorePrivate Qt::Test ) - -#### Keys ignored in scope 1:.:.:qfileinfo.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/benchmarks/corelib/io/qfileinfo/main.cpp b/tests/benchmarks/corelib/io/qfileinfo/tst_bench_qfileinfo.cpp index 2cd06eef27..21dbf47ba2 100644 --- a/tests/benchmarks/corelib/io/qfileinfo/main.cpp +++ b/tests/benchmarks/corelib/io/qfileinfo/tst_bench_qfileinfo.cpp @@ -35,7 +35,7 @@ #include "private/qfsfileengine_p.h" #include "../../../../shared/filesystem.h" -class qfileinfo : public QObject +class tst_QFileInfo : public QObject { Q_OBJECT private slots: @@ -45,34 +45,22 @@ private slots: void symLinkTargetPerformanceLNK(); void junctionTargetPerformanceMountpoint(); #endif - void initTestCase(); - void cleanupTestCase(); -public: - qfileinfo() : QObject() {}; }; -void qfileinfo::initTestCase() -{ -} - -void qfileinfo::cleanupTestCase() -{ -} - -void qfileinfo::existsTemporary() +void tst_QFileInfo::existsTemporary() { QString appPath = QCoreApplication::applicationFilePath(); QBENCHMARK { QFileInfo(appPath).exists(); } } -void qfileinfo::existsStatic() +void tst_QFileInfo::existsStatic() { QString appPath = QCoreApplication::applicationFilePath(); QBENCHMARK { QFileInfo::exists(appPath); } } #if defined(Q_OS_WIN) -void qfileinfo::symLinkTargetPerformanceLNK() +void tst_QFileInfo::symLinkTargetPerformanceLNK() { QVERIFY(QFile::link("file","link.lnk")); QFileInfo info("link.lnk"); @@ -86,7 +74,7 @@ void qfileinfo::symLinkTargetPerformanceLNK() QVERIFY(QFile::remove("link.lnk")); } -void qfileinfo::junctionTargetPerformanceMountpoint() +void tst_QFileInfo::junctionTargetPerformanceMountpoint() { wchar_t buffer[MAX_PATH]; QString rootPath = QDir::toNativeSeparators(QDir::rootPath()); @@ -109,6 +97,6 @@ void qfileinfo::junctionTargetPerformanceMountpoint() } #endif -QTEST_MAIN(qfileinfo) +QTEST_MAIN(tst_QFileInfo) -#include "main.moc" +#include "tst_bench_qfileinfo.moc" diff --git a/tests/benchmarks/corelib/io/qiodevice/CMakeLists.txt b/tests/benchmarks/corelib/io/qiodevice/CMakeLists.txt index 3af6d4f214..ab8abc8788 100644 --- a/tests/benchmarks/corelib/io/qiodevice/CMakeLists.txt +++ b/tests/benchmarks/corelib/io/qiodevice/CMakeLists.txt @@ -1,15 +1,10 @@ -# Generated from qiodevice.pro. - ##################################################################### ## tst_bench_qiodevice Binary: ##################################################################### qt_internal_add_benchmark(tst_bench_qiodevice SOURCES - main.cpp + tst_bench_qiodevice.cpp PUBLIC_LIBRARIES Qt::Test ) - -#### Keys ignored in scope 1:.:.:qiodevice.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/benchmarks/corelib/io/qiodevice/main.cpp b/tests/benchmarks/corelib/io/qiodevice/tst_bench_qiodevice.cpp index de4660a253..47e616b409 100644 --- a/tests/benchmarks/corelib/io/qiodevice/main.cpp +++ b/tests/benchmarks/corelib/io/qiodevice/tst_bench_qiodevice.cpp @@ -32,8 +32,7 @@ #include <qtest.h> - -class tst_qiodevice : public QObject +class tst_QIODevice : public QObject { Q_OBJECT private slots: @@ -48,7 +47,7 @@ private: }; -void tst_qiodevice::read_data() +void tst_QIODevice::read_data() { QTest::addColumn<qint64>("size"); QTest::newRow("10k") << qint64(10 * 1024); @@ -59,7 +58,7 @@ void tst_qiodevice::read_data() QTest::newRow("1000000k") << qint64(1000000 * 1024); } -void tst_qiodevice::read_old() +void tst_QIODevice::read_old() { QFETCH(qint64, size); @@ -88,7 +87,7 @@ void tst_qiodevice::read_old() } } -void tst_qiodevice::peekAndRead() +void tst_QIODevice::peekAndRead() { QFETCH(qint64, size); @@ -119,6 +118,6 @@ void tst_qiodevice::peekAndRead() } } -QTEST_MAIN(tst_qiodevice) +QTEST_MAIN(tst_QIODevice) -#include "main.moc" +#include "tst_bench_qiodevice.moc" diff --git a/tests/benchmarks/corelib/io/qprocess/test/CMakeLists.txt b/tests/benchmarks/corelib/io/qprocess/test/CMakeLists.txt index ca7011a661..b08034e71d 100644 --- a/tests/benchmarks/corelib/io/qprocess/test/CMakeLists.txt +++ b/tests/benchmarks/corelib/io/qprocess/test/CMakeLists.txt @@ -1,5 +1,3 @@ -# Generated from test.pro. - ##################################################################### ## tst_bench_qprocess Binary: ##################################################################### diff --git a/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/CMakeLists.txt b/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/CMakeLists.txt index 896435b27b..a55a1e113a 100644 --- a/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/CMakeLists.txt +++ b/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/CMakeLists.txt @@ -2,4 +2,4 @@ ## testProcessLoopback Binary: ##################################################################### -add_executable(testProcessLoopback main.cpp) +add_executable(testProcessLoopback loopback.cpp) diff --git a/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/main.cpp b/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/loopback.cpp index 1773ba7496..1773ba7496 100644 --- a/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/main.cpp +++ b/tests/benchmarks/corelib/io/qprocess/testProcessLoopback/loopback.cpp diff --git a/tests/benchmarks/corelib/io/qtemporaryfile/CMakeLists.txt b/tests/benchmarks/corelib/io/qtemporaryfile/CMakeLists.txt index a12bfd1260..5342cf8912 100644 --- a/tests/benchmarks/corelib/io/qtemporaryfile/CMakeLists.txt +++ b/tests/benchmarks/corelib/io/qtemporaryfile/CMakeLists.txt @@ -1,15 +1,10 @@ -# Generated from qtemporaryfile.pro. - ##################################################################### ## tst_bench_qtemporaryfile Binary: ##################################################################### qt_internal_add_benchmark(tst_bench_qtemporaryfile SOURCES - main.cpp + tst_bench_qtemporaryfile.cpp PUBLIC_LIBRARIES Qt::Test ) - -#### Keys ignored in scope 1:.:.:qtemporaryfile.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/benchmarks/corelib/io/qtemporaryfile/main.cpp b/tests/benchmarks/corelib/io/qtemporaryfile/tst_bench_qtemporaryfile.cpp index c50032d174..fb855f1eda 100644 --- a/tests/benchmarks/corelib/io/qtemporaryfile/main.cpp +++ b/tests/benchmarks/corelib/io/qtemporaryfile/tst_bench_qtemporaryfile.cpp @@ -32,8 +32,7 @@ #include <QTemporaryFile> #include <qtest.h> - -class tst_qtemporaryfile : public QObject +class tst_QTemporaryFile : public QObject { Q_OBJECT private slots: @@ -45,7 +44,7 @@ private slots: private: }; -void tst_qtemporaryfile::openclose_data() +void tst_QTemporaryFile::openclose_data() { QTest::addColumn<qint64>("amount"); QTest::newRow("100") << qint64(100); @@ -53,7 +52,7 @@ void tst_qtemporaryfile::openclose_data() QTest::newRow("10000") << qint64(10000); } -void tst_qtemporaryfile::openclose() +void tst_QTemporaryFile::openclose() { QFETCH(qint64, amount); @@ -66,7 +65,7 @@ void tst_qtemporaryfile::openclose() } } -void tst_qtemporaryfile::readwrite() +void tst_QTemporaryFile::readwrite() { QFETCH(qint64, amount); @@ -85,6 +84,6 @@ void tst_qtemporaryfile::readwrite() } } -QTEST_MAIN(tst_qtemporaryfile) +QTEST_MAIN(tst_QTemporaryFile) -#include "main.moc" +#include "tst_bench_qtemporaryfile.moc" diff --git a/tests/benchmarks/corelib/io/qtextstream/CMakeLists.txt b/tests/benchmarks/corelib/io/qtextstream/CMakeLists.txt index 0393b91119..b54610ad74 100644 --- a/tests/benchmarks/corelib/io/qtextstream/CMakeLists.txt +++ b/tests/benchmarks/corelib/io/qtextstream/CMakeLists.txt @@ -1,15 +1,10 @@ -# Generated from qtextstream.pro. - ##################################################################### ## tst_bench_qtextstream Binary: ##################################################################### qt_internal_add_benchmark(tst_bench_qtextstream SOURCES - main.cpp + tst_bench_qtextstream.cpp PUBLIC_LIBRARIES Qt::Test ) - -#### Keys ignored in scope 1:.:.:qtextstream.pro:<TRUE>: -# TEMPLATE = "app" diff --git a/tests/benchmarks/corelib/io/qtextstream/main.cpp b/tests/benchmarks/corelib/io/qtextstream/tst_bench_qtextstream.cpp index 03dc3d1694..1da0d90c79 100644 --- a/tests/benchmarks/corelib/io/qtextstream/main.cpp +++ b/tests/benchmarks/corelib/io/qtextstream/tst_bench_qtextstream.cpp @@ -32,7 +32,7 @@ #include <QBuffer> #include <qtest.h> -class tst_qtextstream : public QObject +class tst_QTextStream : public QObject { Q_OBJECT private slots: @@ -48,7 +48,7 @@ Q_DECLARE_METATYPE(Output); enum Input { CharStarInput, QStringInput, CharInput, QCharInput }; Q_DECLARE_METATYPE(Input); -void tst_qtextstream::writeSingleChar_data() +void tst_QTextStream::writeSingleChar_data() { QTest::addColumn<Output>("output"); QTest::addColumn<Input>("input"); @@ -63,7 +63,7 @@ void tst_qtextstream::writeSingleChar_data() QTest::newRow("device_qchar") << DeviceOutput << QCharInput; } -void tst_qtextstream::writeSingleChar() +void tst_QTextStream::writeSingleChar() { QFETCH(Output, output); QFETCH(Input, input); @@ -115,6 +115,6 @@ void tst_qtextstream::writeSingleChar() QCOMPARE(result.left(10), QString("hhhhhhhhhh")); } -QTEST_MAIN(tst_qtextstream) +QTEST_MAIN(tst_QTextStream) -#include "main.moc" +#include "tst_bench_qtextstream.moc" diff --git a/tests/benchmarks/corelib/io/qurl/CMakeLists.txt b/tests/benchmarks/corelib/io/qurl/CMakeLists.txt index d38c8b18c0..e9c155ad3f 100644 --- a/tests/benchmarks/corelib/io/qurl/CMakeLists.txt +++ b/tests/benchmarks/corelib/io/qurl/CMakeLists.txt @@ -1,23 +1,18 @@ -# Generated from qurl.pro. - ##################################################################### ## tst_qurl Binary: ##################################################################### -qt_internal_add_benchmark(tst_qurl +qt_internal_add_benchmark(tst_bench_qurl SOURCES - main.cpp + tst_bench_qurl.cpp PUBLIC_LIBRARIES Qt::Test ) -#### Keys ignored in scope 1:.:.:qurl.pro:<TRUE>: -# TEMPLATE = "app" - ## Scopes: ##################################################################### -qt_internal_extend_target(tst_qurl CONDITION WIN32 +qt_internal_extend_target(tst_bench_qurl CONDITION WIN32 DEFINES _CRT_SECURE_NO_WARNINGS ) diff --git a/tests/benchmarks/corelib/io/qurl/main.cpp b/tests/benchmarks/corelib/io/qurl/tst_bench_qurl.cpp index 5ad3c3bd47..8165f8d059 100644 --- a/tests/benchmarks/corelib/io/qurl/main.cpp +++ b/tests/benchmarks/corelib/io/qurl/tst_bench_qurl.cpp @@ -29,7 +29,7 @@ #include <qurl.h> #include <qtest.h> -class tst_qurl: public QObject +class tst_QUrl : public QObject { Q_OBJECT @@ -53,28 +53,28 @@ private: void generateFirstRunData(); }; -void tst_qurl::emptyUrl() +void tst_QUrl::emptyUrl() { QBENCHMARK { QUrl url; } } -void tst_qurl::relativeUrl() +void tst_QUrl::relativeUrl() { QBENCHMARK { QUrl url("pics/avatar.png"); } } -void tst_qurl::absoluteUrl() +void tst_QUrl::absoluteUrl() { QBENCHMARK { QUrl url("/tmp/avatar.png"); } } -void tst_qurl::generateFirstRunData() +void tst_QUrl::generateFirstRunData() { QTest::addColumn<bool>("firstRun"); @@ -82,12 +82,12 @@ void tst_qurl::generateFirstRunData() QTest::newRow("subsequent runs") << false; } -void tst_qurl::isRelative_data() +void tst_QUrl::isRelative_data() { generateFirstRunData(); } -void tst_qurl::isRelative() +void tst_QUrl::isRelative() { QFETCH(bool, firstRun); if (firstRun) { @@ -103,12 +103,12 @@ void tst_qurl::isRelative() } } -void tst_qurl::toLocalFile_data() +void tst_QUrl::toLocalFile_data() { generateFirstRunData(); } -void tst_qurl::toLocalFile() +void tst_QUrl::toLocalFile() { QFETCH(bool, firstRun); if (firstRun) { @@ -124,12 +124,12 @@ void tst_qurl::toLocalFile() } } -void tst_qurl::toString_data() +void tst_QUrl::toString_data() { generateFirstRunData(); } -void tst_qurl::toString() +void tst_QUrl::toString() { QFETCH(bool, firstRun); if(firstRun) { @@ -145,35 +145,37 @@ void tst_qurl::toString() } } -void tst_qurl::resolved_data() +void tst_QUrl::resolved_data() { generateFirstRunData(); } -void tst_qurl::resolved() +void tst_QUrl::resolved() { QFETCH(bool, firstRun); - if(firstRun) { + QUrl expect("/home/user/pics/avatar.png"), actual; + if (firstRun) { QBENCHMARK { QUrl baseUrl("/home/user/"); QUrl url("pics/avatar.png"); - baseUrl.resolved(url); + actual = baseUrl.resolved(url); } } else { QUrl baseUrl("/home/user/"); QUrl url("pics/avatar.png"); QBENCHMARK { - baseUrl.resolved(url); + actual = baseUrl.resolved(url); } } + QCOMPARE(actual, expect); } -void tst_qurl::equality_data() +void tst_QUrl::equality_data() { generateFirstRunData(); } -void tst_qurl::equality() +void tst_QUrl::equality() { QFETCH(bool, firstRun); if(firstRun) { @@ -191,7 +193,7 @@ void tst_qurl::equality() } } -void tst_qurl::qmlPropertyWriteUseCase() +void tst_QUrl::qmlPropertyWriteUseCase() { QUrl base("file:///home/user/qt/examples/declarative/samegame/SamegameCore/"); QString str("pics/redStar.png"); @@ -203,6 +205,6 @@ void tst_qurl::qmlPropertyWriteUseCase() } } -QTEST_MAIN(tst_qurl) +QTEST_MAIN(tst_QUrl) -#include "main.moc" +#include "tst_bench_qurl.moc" |