aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2012-09-27 20:30:07 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2012-09-27 20:30:07 +0200
commit6c944f97b202bc8d1c3ee25259455170ea82a80d (patch)
tree001e4324c4c5aca7015c8c4612e177ec00400390 /tests
parent49600c7d56b16d7b60705f170e9dff4daf58688c (diff)
downloadqxmpp-6c944f97b202bc8d1c3ee25259455170ea82a80d.tar.gz
split RPC tests
Diffstat (limited to 'tests')
-rw-r--r--tests/all/all.pro8
-rw-r--r--tests/all/rpc.h45
-rw-r--r--tests/all/tests.cpp4
-rw-r--r--tests/qxmpprpciq/qxmpprpciq.pro3
-rw-r--r--tests/qxmpprpciq/tst_qxmpprpciq.cpp (renamed from tests/all/rpc.cpp)49
-rw-r--r--tests/tests.pro1
6 files changed, 41 insertions, 69 deletions
diff --git a/tests/all/all.pro b/tests/all/all.pro
index 5ba9e1f3..8ef977bb 100644
--- a/tests/all/all.pro
+++ b/tests/all/all.pro
@@ -3,12 +3,8 @@ include(../tests.pri)
TARGET = tst_all
RESOURCES += tests.qrc
-SOURCES += \
- rpc.cpp \
- tests.cpp
-HEADERS += \
- rpc.h \
- tests.h
+SOURCES += tests.cpp
+HEADERS += tests.h
!isEmpty(QXMPP_AUTOTEST_INTERNAL) {
HEADERS += sasl.h
diff --git a/tests/all/rpc.h b/tests/all/rpc.h
deleted file mode 100644
index f3a0c5e0..00000000
--- a/tests/all/rpc.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2008-2012 The QXmpp developers
- *
- * Author:
- * Jeremy Lainé
- *
- * Source:
- * http://code.google.com/p/qxmpp
- *
- * This file is a part of QXmpp library.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- */
-
-#include <QObject>
-
-class TestXmlRpc : public QObject
-{
- Q_OBJECT
-
-private slots:
- void testBase64();
- void testBool();
- void testDateTime();
- void testDouble();
- void testInt();
- void testNil();
- void testString();
-
- void testArray();
- void testStruct();
-
- void testInvoke();
- void testResponse();
- void testResponseFault();
-};
diff --git a/tests/all/tests.cpp b/tests/all/tests.cpp
index 8fd2b806..a7095408 100644
--- a/tests/all/tests.cpp
+++ b/tests/all/tests.cpp
@@ -44,7 +44,6 @@
#include "QXmppGlobal.h"
#include "QXmppEntityTimeIq.h"
-#include "rpc.h"
#include "sasl.h"
#include "tests.h"
#include "util.h"
@@ -894,9 +893,6 @@ int main(int argc, char *argv[])
TestServer testServer;
errors += QTest::qExec(&testServer);
- TestXmlRpc testXmlRpc;
- errors += QTest::qExec(&testXmlRpc);
-
if (errors)
{
qWarning() << "Total failed tests:" << errors;
diff --git a/tests/qxmpprpciq/qxmpprpciq.pro b/tests/qxmpprpciq/qxmpprpciq.pro
new file mode 100644
index 00000000..e818b0a3
--- /dev/null
+++ b/tests/qxmpprpciq/qxmpprpciq.pro
@@ -0,0 +1,3 @@
+include(../tests.pri)
+TARGET = tst_qxmpprpciq
+SOURCES += tst_qxmpprpciq.cpp
diff --git a/tests/all/rpc.cpp b/tests/qxmpprpciq/tst_qxmpprpciq.cpp
index c0714957..97f7f1fb 100644
--- a/tests/all/rpc.cpp
+++ b/tests/qxmpprpciq/tst_qxmpprpciq.cpp
@@ -21,9 +21,8 @@
*
*/
+#include <QObject>
#include "QXmppRpcIq.h"
-
-#include "rpc.h"
#include "util.h"
static void checkVariant(const QVariant &value, const QByteArray &xml)
@@ -49,13 +48,33 @@ static void checkVariant(const QVariant &value, const QByteArray &xml)
QCOMPARE(test, value);
}
-void TestXmlRpc::testBase64()
+class tst_QXmppRpcIq : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void testBase64();
+ void testBool();
+ void testDateTime();
+ void testDouble();
+ void testInt();
+ void testNil();
+ void testString();
+
+ void testArray();
+ void testStruct();
+
+ void testInvoke();
+ void testResponse();
+ void testResponseFault();
+};
+void tst_QXmppRpcIq::testBase64()
{
checkVariant(QByteArray("\0\1\2\3", 4),
QByteArray("<value><base64>AAECAw==</base64></value>"));
}
-void TestXmlRpc::testBool()
+void tst_QXmppRpcIq::testBool()
{
checkVariant(false,
QByteArray("<value><boolean>0</boolean></value>"));
@@ -63,37 +82,37 @@ void TestXmlRpc::testBool()
QByteArray("<value><boolean>1</boolean></value>"));
}
-void TestXmlRpc::testDateTime()
+void tst_QXmppRpcIq::testDateTime()
{
checkVariant(QDateTime(QDate(1998, 7, 17), QTime(14, 8, 55)),
QByteArray("<value><dateTime.iso8601>1998-07-17T14:08:55</dateTime.iso8601></value>"));
}
-void TestXmlRpc::testDouble()
+void tst_QXmppRpcIq::testDouble()
{
checkVariant(double(-12.214),
QByteArray("<value><double>-12.214</double></value>"));
}
-void TestXmlRpc::testInt()
+void tst_QXmppRpcIq::testInt()
{
checkVariant(int(-12),
QByteArray("<value><i4>-12</i4></value>"));
}
-void TestXmlRpc::testNil()
+void tst_QXmppRpcIq::testNil()
{
checkVariant(QVariant(),
QByteArray("<value><nil/></value>"));
}
-void TestXmlRpc::testString()
+void tst_QXmppRpcIq::testString()
{
checkVariant(QString("hello world"),
QByteArray("<value><string>hello world</string></value>"));
}
-void TestXmlRpc::testArray()
+void tst_QXmppRpcIq::testArray()
{
checkVariant(QVariantList() << QString("hello world") << double(-12.214),
QByteArray("<value><array><data>"
@@ -102,7 +121,7 @@ void TestXmlRpc::testArray()
"</data></array></value>"));
}
-void TestXmlRpc::testStruct()
+void tst_QXmppRpcIq::testStruct()
{
QMap<QString, QVariant> map;
map["bar"] = QString("hello world");
@@ -120,7 +139,7 @@ void TestXmlRpc::testStruct()
"</struct></value>"));
}
-void TestXmlRpc::testInvoke()
+void tst_QXmppRpcIq::testInvoke()
{
const QByteArray xml(
"<iq"
@@ -147,7 +166,7 @@ void TestXmlRpc::testInvoke()
serializePacket(iq, xml);
}
-void TestXmlRpc::testResponse()
+void tst_QXmppRpcIq::testResponse()
{
const QByteArray xml(
"<iq"
@@ -174,7 +193,7 @@ void TestXmlRpc::testResponse()
serializePacket(iq, xml);
}
-void TestXmlRpc::testResponseFault()
+void tst_QXmppRpcIq::testResponseFault()
{
const QByteArray xml(
"<iq"
@@ -210,3 +229,5 @@ void TestXmlRpc::testResponseFault()
serializePacket(iq, xml);
}
+QTEST_MAIN(tst_QXmppRpcIq)
+#include "tst_qxmpprpciq.moc"
diff --git a/tests/tests.pro b/tests/tests.pro
index 47f6ff94..fd52820c 100644
--- a/tests/tests.pro
+++ b/tests/tests.pro
@@ -9,6 +9,7 @@ SUBDIRS = \
qxmppregisteriq \
qxmppresultset \
qxmpprosteriq \
+ qxmpprpciq \
qxmpprtppacket \
qxmppstanza \
qxmppstunmessage \