Git commit 0ce1308257be5ed4aeea7a52614f974fad8598c2 by Dan Vr=C3=A1til. Committed on 31/05/2015 at 23:01. Pushed by dvratil into branch 'dev/binary-protocol'. Partially re-enable tests, remove ImapParserBenchmark M +1 -1 CMakeLists.txt M +1 -1 autotests/CMakeLists.txt M +0 -2 autotests/private/CMakeLists.txt D +0 -123 autotests/private/imapparserbenchmark.cpp http://commits.kde.org/akonadi/0ce1308257be5ed4aeea7a52614f974fad8598c2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 007ed8b..21c8287 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -234,7 +234,7 @@ include_directories( ) = add_subdirectory(src) -#add_subdirectory(autotests) +add_subdirectory(autotests) = = ############### install stuff ############### diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt index b37ae43..b1fffe7 100644 --- a/autotests/CMakeLists.txt +++ b/autotests/CMakeLists.txt @@ -1,2 +1,2 @@ add_subdirectory(private) -add_subdirectory(server) \ No newline at end of file +#add_subdirectory(server) \ No newline at end of file diff --git a/autotests/private/CMakeLists.txt b/autotests/private/CMakeList= s.txt index 1b90ce8..2724565 100644 --- a/autotests/private/CMakeLists.txt +++ b/autotests/private/CMakeLists.txt @@ -22,5 +22,3 @@ endmacro() = add_unit_test(notificationmessagetest.cpp) add_unit_test(notificationmessagev2test.cpp) -#Avoid running a benchmark every time during make test -#add_unit_test(imapparserbenchmark.cpp) diff --git a/autotests/private/imapparserbenchmark.cpp b/autotests/private/= imapparserbenchmark.cpp deleted file mode 100644 index 859728b..0000000 --- a/autotests/private/imapparserbenchmark.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* - Copyright (c) 2010 Volker Krause - - This library is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published= by - the Free Software Foundation; either version 2 of the License, or (at = your - option) any later version. - - This library is distributed in the hope that it will be useful, but WI= THOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public - License for more details. - - You should have received a copy of the GNU Library General Public Lice= nse - along with this library; see the file COPYING.LIB. If not, write to t= he - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Bosto= n, MA - 02110-1301, USA. -*/ - -#include -#include - -using namespace Akonadi; - -Q_DECLARE_METATYPE(QList) - -class ImapParserBenchmark : public QObject -{ - Q_OBJECT -private Q_SLOTS: - void quote_data() - { - QTest::addColumn("input"); - QTest::newRow("empty") << QByteArray(); - QTest::newRow("10-idle") << QByteArray("ababababab"); - QTest::newRow("10-quote") << QByteArray("\"abababab\""); - QTest::newRow("50-idle") << QByteArray("ababababababababababababab= abababababababababababab"); - QTest::newRow("50-quote") << QByteArray("\"abababab\ncabababab\nca= bababab\ncabababab\ncabababab\""); - } - - void quote() - { - QFETCH(QByteArray, input); - QBENCHMARK { - ImapParser::quote(input); - } - } - - void join_data() - { - QTest::addColumn >("list"); - QTest::newRow("empty") << QList(); - QTest::newRow("single") << (QList() << "ababab"); - QTest::newRow("two") << (QList() << "ababab" << "ababa= b"); - QTest::newRow("five") << (QList() << "ababab" << "abab= ab" << "ababab" << "ababab" << "ababab"); - QList list; - for (int i =3D 0; i < 50; ++i) { - list << "ababab"; - } - QTest::newRow("a lot") << list; - } - - void join() - { - QFETCH(QList, list); - QBENCHMARK { - ImapParser::join(list, " "); - } - } - - void parseParenthesizedList_data() - { - QTest::addColumn("data"); - QTest::newRow("empty") << QByteArray(); - QTest::newRow("unnested") << QByteArray("(\"Foo Bar\" NIL \"foobar= \" \"test.com\")"); - QTest::newRow("nested") << QByteArray("((\"Foo Bar\" NIL \"foobar\= " \"test.com\"))"); - QTest::newRow("nested-long") << QByteArray("(UID 86 REV 0 MIMETYPE= \"message/rfc822\" COLLECTIONID 13 SIZE 6114 FLAGS (\\SEEN)" - " ANCESTORS ((13 \"/INB= OX\") (12 \"imap://mail@mail.test.com/\") (0 \"\")) PLD:ENVELOPE[1] {396}" - " (\"Fri, 04 Jun 2010 0= 9:07:54 +0200\" \"Re: [ADMIN] foobar available again!\"" - " ((\"Foo Bar\" NIL \"f= oobar\" \"test.com\"))" - " NIL NIL" - " ((\"Asdf Bla Blub\" N= IL \"asdf.bla.blub\" \"123test.org\"))" - " ((NIL NIL \"muh.kuh\"= \"lalala.com\") (\"Konqi KDE\" NIL \"konqi\" \"kde.org\") (NIL NIL \"all\"= \"test.com\"))" - " NIL \"<201006040905.3= 3367.foo.bar@test.com>\" \"<4C08A64A.9020205@123test.org>\"" - " \"<201006040142.56540= .muh.kuh@lalala.com> <201006040704.39648.konqi@kde.org> <201006040905.33367= .foo.bar@test.com>\"" - "))"); - } - - void parseParenthesizedList() - { - QFETCH(QByteArray, data); - QVarLengthArray result; - QBENCHMARK { - ImapParser::parseParenthesizedList(data, result, 0); - } - } - - void parseNumber() - { - QByteArray data( "123456" ); - qint64 result; - bool ok =3D false; - QBENCHMARK { - ImapParser::parseNumber( data, result, &ok ); - } - QVERIFY(ok); - QCOMPARE(result, qint64(123456)); - } - - void parseDateTime() - { - QByteArray data( "28-May-2006 01:03:35 +0000" ); - QDateTime result; - QBENCHMARK { - ImapParser::parseDateTime( data, result ); - } - QCOMPARE(result.toString( QString::fromUtf8( "dd-MMM-yyyy hh:mm:ss += 0000" ) ), QString::fromUtf8( data )); - } -}; - -#include "imapparserbenchmark.moc" - -QTEST_APPLESS_MAIN(ImapParserBenchmark)