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/text | |
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/text')
12 files changed, 33 insertions, 52 deletions
diff --git a/tests/benchmarks/corelib/text/qbytearray/CMakeLists.txt b/tests/benchmarks/corelib/text/qbytearray/CMakeLists.txt index 50574aa221..18b811501b 100644 --- a/tests/benchmarks/corelib/text/qbytearray/CMakeLists.txt +++ b/tests/benchmarks/corelib/text/qbytearray/CMakeLists.txt @@ -1,16 +1,10 @@ -# Generated from qbytearray.pro. - ##################################################################### ## tst_bench_qbytearray Binary: ##################################################################### qt_internal_add_benchmark(tst_bench_qbytearray SOURCES - main.cpp + tst_bench_qbytearray.cpp PUBLIC_LIBRARIES Qt::Test ) - -#### Keys ignored in scope 1:.:.:qbytearray.pro:<TRUE>: -# TEMPLATE = "app" -# TESTDATA = "main.cpp" diff --git a/tests/benchmarks/corelib/text/qbytearray/main.cpp b/tests/benchmarks/corelib/text/qbytearray/tst_bench_qbytearray.cpp index 43151041d0..01ee46c53e 100644 --- a/tests/benchmarks/corelib/text/qbytearray/main.cpp +++ b/tests/benchmarks/corelib/text/qbytearray/tst_bench_qbytearray.cpp @@ -34,8 +34,7 @@ #include <qtest.h> #include <limits> - -class tst_qbytearray : public QObject +class tst_QByteArray : public QObject { Q_OBJECT QByteArray sourcecode; @@ -59,14 +58,14 @@ private slots: void toPercentEncoding(); }; -void tst_qbytearray::initTestCase() +void tst_QByteArray::initTestCase() { - QFile self(QFINDTESTDATA("main.cpp")); + QFile self(QFINDTESTDATA("tst_bench_qbytearray.cpp")); QVERIFY(self.open(QIODevice::ReadOnly)); sourcecode = self.readAll(); } -void tst_qbytearray::append_data() +void tst_QByteArray::append_data() { QTest::addColumn<int>("size"); QTest::newRow("1") << int(1); @@ -80,7 +79,7 @@ void tst_qbytearray::append_data() QTest::newRow("100000000") << int(100000000); } -void tst_qbytearray::append() +void tst_QByteArray::append() { QFETCH(int, size); @@ -106,7 +105,7 @@ static QByteArray decNext(QByteArray &&big) return big; } -void tst_qbytearray::toLongLong_data() +void tst_QByteArray::toLongLong_data() { QTest::addColumn<QByteArray>("text"); QTest::addColumn<bool>("good"); @@ -127,7 +126,7 @@ void tst_qbytearray::toLongLong_data() QTest::newRow("max+1") << decNext(QByteArray::number(LL::max())) << false << 0LL; } -void tst_qbytearray::toLongLong() +void tst_QByteArray::toLongLong() { QFETCH(QByteArray, text); QFETCH(bool, good); @@ -142,7 +141,7 @@ void tst_qbytearray::toLongLong() QCOMPARE(ok, good); } -void tst_qbytearray::toULongLong_data() +void tst_QByteArray::toULongLong_data() { QTest::addColumn<QByteArray>("text"); QTest::addColumn<bool>("good"); @@ -160,7 +159,7 @@ void tst_qbytearray::toULongLong_data() QTest::newRow("max+1") << decNext(QByteArray::number(ULL::max())) << false << 0ULL; } -void tst_qbytearray::toULongLong() +void tst_QByteArray::toULongLong() { QFETCH(QByteArray, text); QFETCH(bool, good); @@ -175,7 +174,7 @@ void tst_qbytearray::toULongLong() QCOMPARE(ok, good); } -void tst_qbytearray::latin1Uppercasing_qt54() +void tst_QByteArray::latin1Uppercasing_qt54() { QByteArray s = sourcecode; s.detach(); @@ -224,7 +223,7 @@ static const uchar uppercased[256] = { 0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf, 0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xf7,0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xff }; -void tst_qbytearray::latin1Uppercasing_xlate() +void tst_QByteArray::latin1Uppercasing_xlate() { QByteArray output = sourcecode; output.detach(); @@ -238,7 +237,7 @@ void tst_qbytearray::latin1Uppercasing_xlate() } } -void tst_qbytearray::latin1Uppercasing_xlate_checked() +void tst_QByteArray::latin1Uppercasing_xlate_checked() { QByteArray output = sourcecode; output.detach(); @@ -291,7 +290,7 @@ static const char categories[256] = { 2,2,2,2,2,2,2,0,2,2,2,2,2,2,2,0 }; -void tst_qbytearray::latin1Uppercasing_category() +void tst_QByteArray::latin1Uppercasing_category() { QByteArray output = sourcecode; output.detach(); @@ -336,7 +335,7 @@ static bool bittest(const quint32 *data, uchar bit) return data[bit / bitsperelem] & (1 << (bit & (bitsperelem - 1))); } -void tst_qbytearray::latin1Uppercasing_bitcheck() +void tst_QByteArray::latin1Uppercasing_bitcheck() { QByteArray output = sourcecode; output.detach(); @@ -350,7 +349,7 @@ void tst_qbytearray::latin1Uppercasing_bitcheck() } } -void tst_qbytearray::toPercentEncoding_data() +void tst_QByteArray::toPercentEncoding_data() { QTest::addColumn<QByteArray>("plaintext"); QTest::addColumn<QByteArray>("expected"); @@ -369,7 +368,7 @@ void tst_qbytearray::toPercentEncoding_data() "%3D%3E%3F%40%5B%5C%5D%5E%60%7B%7C%7D%7F"); } -void tst_qbytearray::toPercentEncoding() +void tst_QByteArray::toPercentEncoding() { QFETCH(QByteArray, plaintext); QByteArray encoded; @@ -379,6 +378,6 @@ void tst_qbytearray::toPercentEncoding() QTEST(encoded, "expected"); } -QTEST_MAIN(tst_qbytearray) +QTEST_MAIN(tst_QByteArray) -#include "main.moc" +#include "tst_bench_qbytearray.moc" diff --git a/tests/benchmarks/corelib/text/qchar/CMakeLists.txt b/tests/benchmarks/corelib/text/qchar/CMakeLists.txt index afdf96e9d4..ef7f553f2e 100644 --- a/tests/benchmarks/corelib/text/qchar/CMakeLists.txt +++ b/tests/benchmarks/corelib/text/qchar/CMakeLists.txt @@ -1,12 +1,10 @@ -# Generated from qchar.pro. - ##################################################################### ## tst_bench_qchar Binary: ##################################################################### qt_internal_add_benchmark(tst_bench_qchar SOURCES - main.cpp + tst_bench_qchar.cpp PUBLIC_LIBRARIES Qt::Test ) diff --git a/tests/benchmarks/corelib/text/qchar/main.cpp b/tests/benchmarks/corelib/text/qchar/tst_bench_qchar.cpp index 746f9730f7..b1adfdca4e 100644 --- a/tests/benchmarks/corelib/text/qchar/main.cpp +++ b/tests/benchmarks/corelib/text/qchar/tst_bench_qchar.cpp @@ -133,4 +133,4 @@ void tst_QChar::isSpace() QTEST_MAIN(tst_QChar) -#include "main.moc" +#include "tst_bench_qchar.moc" diff --git a/tests/benchmarks/corelib/text/qlocale/CMakeLists.txt b/tests/benchmarks/corelib/text/qlocale/CMakeLists.txt index 1c692af6c8..f319c0b5bd 100644 --- a/tests/benchmarks/corelib/text/qlocale/CMakeLists.txt +++ b/tests/benchmarks/corelib/text/qlocale/CMakeLists.txt @@ -1,12 +1,10 @@ -# Generated from qlocale.pro. - ##################################################################### ## tst_bench_qlocale Binary: ##################################################################### qt_internal_add_benchmark(tst_bench_qlocale SOURCES - main.cpp + tst_bench_qlocale.cpp PUBLIC_LIBRARIES Qt::Test ) diff --git a/tests/benchmarks/corelib/text/qlocale/main.cpp b/tests/benchmarks/corelib/text/qlocale/tst_bench_qlocale.cpp index 887053ae4a..23a64526eb 100644 --- a/tests/benchmarks/corelib/text/qlocale/main.cpp +++ b/tests/benchmarks/corelib/text/qlocale/tst_bench_qlocale.cpp @@ -394,4 +394,4 @@ void tst_QLocale::number_QString() QTEST_MAIN(tst_QLocale) -#include "main.moc" +#include "tst_bench_qlocale.moc" diff --git a/tests/benchmarks/corelib/text/qstringbuilder/CMakeLists.txt b/tests/benchmarks/corelib/text/qstringbuilder/CMakeLists.txt index 33b1b5fe5e..b450aa50a0 100644 --- a/tests/benchmarks/corelib/text/qstringbuilder/CMakeLists.txt +++ b/tests/benchmarks/corelib/text/qstringbuilder/CMakeLists.txt @@ -1,18 +1,12 @@ -# Generated from qstringbuilder.pro. - ##################################################################### ## tst_bench_qstringbuilder Binary: ##################################################################### qt_internal_add_benchmark(tst_bench_qstringbuilder SOURCES - main.cpp + tst_bench_qstringbuilder.cpp PUBLIC_LIBRARIES Qt::Test COMPILE_OPTIONS -g ) - -#### Keys ignored in scope 1:.:.:qstringbuilder.pro:<TRUE>: -# QMAKE_CFLAGS = "-g" -# TEMPLATE = "app" diff --git a/tests/benchmarks/corelib/text/qstringbuilder/main.cpp b/tests/benchmarks/corelib/text/qstringbuilder/tst_bench_qstringbuilder.cpp index 757e2cc683..acb7c14169 100644 --- a/tests/benchmarks/corelib/text/qstringbuilder/main.cpp +++ b/tests/benchmarks/corelib/text/qstringbuilder/tst_bench_qstringbuilder.cpp @@ -96,12 +96,12 @@ #define LITERAL "some string literal" -class tst_qstringbuilder : public QObject +class tst_QStringBuilder : public QObject { Q_OBJECT public: - tst_qstringbuilder() + tst_QStringBuilder() : l1literal(LITERAL), l1string(LITERAL), ba(LITERAL), @@ -408,8 +408,8 @@ private: std::string stdr; }; -QTEST_MAIN(tst_qstringbuilder) - #undef P -#include "main.moc" +QTEST_MAIN(tst_QStringBuilder) + +#include "tst_bench_qstringbuilder.moc" diff --git a/tests/benchmarks/corelib/text/qstringlist/CMakeLists.txt b/tests/benchmarks/corelib/text/qstringlist/CMakeLists.txt index 4649e3408a..58af3c9dd3 100644 --- a/tests/benchmarks/corelib/text/qstringlist/CMakeLists.txt +++ b/tests/benchmarks/corelib/text/qstringlist/CMakeLists.txt @@ -1,12 +1,10 @@ -# Generated from qstringlist.pro. - ##################################################################### ## tst_bench_qstringlist Binary: ##################################################################### qt_internal_add_benchmark(tst_bench_qstringlist SOURCES - main.cpp + tst_bench_qstringlist.cpp PUBLIC_LIBRARIES Qt::Test ) diff --git a/tests/benchmarks/corelib/text/qstringlist/main.cpp b/tests/benchmarks/corelib/text/qstringlist/tst_bench_qstringlist.cpp index 5c54bcebc5..327f4dc1a1 100644 --- a/tests/benchmarks/corelib/text/qstringlist/main.cpp +++ b/tests/benchmarks/corelib/text/qstringlist/tst_bench_qstringlist.cpp @@ -237,4 +237,4 @@ void tst_QStringList::split_stdlist_stdstring() const QTEST_MAIN(tst_QStringList) -#include "main.moc" +#include "tst_bench_qstringlist.moc" diff --git a/tests/benchmarks/corelib/text/qstringtokenizer/CMakeLists.txt b/tests/benchmarks/corelib/text/qstringtokenizer/CMakeLists.txt index c2bf848400..92dd6cec98 100644 --- a/tests/benchmarks/corelib/text/qstringtokenizer/CMakeLists.txt +++ b/tests/benchmarks/corelib/text/qstringtokenizer/CMakeLists.txt @@ -4,7 +4,7 @@ qt_internal_add_benchmark(tst_bench_qstringtokenizer SOURCES - main.cpp + tst_bench_qstringtokenizer.cpp PUBLIC_LIBRARIES Qt::Test ) diff --git a/tests/benchmarks/corelib/text/qstringtokenizer/main.cpp b/tests/benchmarks/corelib/text/qstringtokenizer/tst_bench_qstringtokenizer.cpp index 54f48d5ea5..291b314a7f 100644 --- a/tests/benchmarks/corelib/text/qstringtokenizer/main.cpp +++ b/tests/benchmarks/corelib/text/qstringtokenizer/tst_bench_qstringtokenizer.cpp @@ -142,4 +142,4 @@ void tst_QStringTokenizer::tokenize() const QTEST_MAIN(tst_QStringTokenizer) -#include "main.moc" +#include "tst_bench_qstringtokenizer.moc" |