aboutsummaryrefslogtreecommitdiff
path: root/tests/tests.cpp
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2012-07-18 11:46:20 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2012-07-18 11:46:20 +0200
commit4fb81e112fe2d334b0627359ff02015d514abae7 (patch)
treed467263dc6f11e0a002776c2f7968665b7fafb75 /tests/tests.cpp
parent034ce16c9afc6715881b78710fb4c896297fc433 (diff)
downloadqxmpp-4fb81e112fe2d334b0627359ff02015d514abae7.tar.gz
re-order tests
Diffstat (limited to 'tests/tests.cpp')
-rw-r--r--tests/tests.cpp261
1 files changed, 128 insertions, 133 deletions
diff --git a/tests/tests.cpp b/tests/tests.cpp
index 3c3dcfbf..008968f9 100644
--- a/tests/tests.cpp
+++ b/tests/tests.cpp
@@ -1393,6 +1393,131 @@ void TestRtp::testWithCsrc()
QCOMPARE(packet.encode(), data);
}
+void TestRsm::testQuery_data()
+{
+ QTest::addColumn<QByteArray>("xml");
+ QTest::addColumn<int>("max");
+ QTest::addColumn<int>("index");
+ QTest::addColumn<QString>("before");
+ QTest::addColumn<QString>("after");
+
+ QTest::newRow("Example 3") <<
+ QByteArray("<set xmlns=\"http://jabber.org/protocol/rsm\">"
+ "<max>10</max>"
+ "</set>")
+ << 10 << -1 << QString() << QString();
+
+ QTest::newRow("Example 5") <<
+ QByteArray("<set xmlns=\"http://jabber.org/protocol/rsm\">"
+ "<max>10</max>"
+ "<after>peterpan@neverland.lit</after>"
+ "</set>")
+ << 10 << -1 << QString() << QString("peterpan@neverland.lit");
+
+ QTest::newRow("Example 5") <<
+ QByteArray("<set xmlns=\"http://jabber.org/protocol/rsm\">"
+ "<max>10</max>"
+ "<before>peter@pixyland.org</before>"
+ "</set>")
+ << 10 << -1 << QString("peter@pixyland.org") << QString();
+
+ QTest::newRow("Example 11") <<
+ QByteArray("<set xmlns=\"http://jabber.org/protocol/rsm\">"
+ "<max>10</max>"
+ "<before/>"
+ "</set>")
+ << 10 << -1 << QString("") << QString();
+
+ QTest::newRow("Example 12") <<
+ QByteArray("<set xmlns=\"http://jabber.org/protocol/rsm\">"
+ "<max>10</max>"
+ "<index>371</index>"
+ "</set>")
+ << 10 << 371 << QString() << QString();
+
+
+ QTest::newRow("Example 15") <<
+ QByteArray("<set xmlns=\"http://jabber.org/protocol/rsm\">"
+ "<max>0</max>"
+ "</set>")
+ << 0 << -1 << QString() << QString();
+}
+
+void TestRsm::testQuery()
+{
+ QFETCH(QByteArray, xml);
+ QFETCH(int, max);
+ QFETCH(int, index);
+ QFETCH(QString, before);
+ QFETCH(QString, after);
+
+ QXmppResultSetQuery iq;
+ parsePacket(iq, xml);
+ QCOMPARE(iq.max(), max);
+ QCOMPARE(iq.index(), index);
+ QCOMPARE(iq.before(), before);
+ QCOMPARE(iq.before().isNull(), before.isNull());
+ QCOMPARE(iq.after(), after);
+ QCOMPARE(iq.after().isNull(), after.isNull());
+ serializePacket(iq, xml);
+}
+
+void TestRsm::testReply_data()
+{
+ QTest::addColumn<QByteArray>("xml");
+ QTest::addColumn<int>("count");
+ QTest::addColumn<int>("index");
+ QTest::addColumn<QString>("first");
+ QTest::addColumn<QString>("last");
+
+ QTest::newRow("Example 4") <<
+ QByteArray( "<set xmlns=\"http://jabber.org/protocol/rsm\">"
+ "<first index=\"0\">stpeter@jabber.org</first>"
+ "<last>peterpan@neverland.lit</last>"
+ "<count>800</count>"
+ "</set>")
+ << 800 << 0 << QString("stpeter@jabber.org") << QString("peterpan@neverland.lit");
+
+ QTest::newRow("Example 6") <<
+ QByteArray( "<set xmlns=\"http://jabber.org/protocol/rsm\">"
+ "<first index=\"0\">stpeter@jabber.org</first>"
+ "<last>peterpan@neverland.lit</last>"
+ "<count>800</count>"
+ "</set>")
+ << 800 << 0 << QString("stpeter@jabber.org") << QString("peterpan@neverland.lit");
+ QTest::newRow("Example 4") <<
+ QByteArray( "<set xmlns=\"http://jabber.org/protocol/rsm\">"
+ "<first index=\"10\">peter@pixyland.org</first>"
+ "<last>peter@rabbit.lit</last>"
+ "<count>800</count>"
+ "</set>")
+ << 800 << 10 << QString("peter@pixyland.org") << QString("peter@rabbit.lit");
+
+ QTest::newRow("Example 7") <<
+ QByteArray( "<set xmlns=\"http://jabber.org/protocol/rsm\">"
+ "<count>790</count>"
+ "</set>")
+ << 790 << -1 << QString() << QString();
+}
+
+void TestRsm::testReply()
+{
+ QFETCH(QByteArray, xml);
+ QFETCH(int, count);
+ QFETCH(int, index);
+ QFETCH(QString, first);
+ QFETCH(QString, last);
+
+ QXmppResultSetReply iq;
+ parsePacket(iq, xml);
+ QCOMPARE(iq.count(), count);
+ QCOMPARE(iq.index(), index);
+ QCOMPARE(iq.first(), first);
+ QCOMPARE(iq.first().isNull(), first.isNull());
+ QCOMPARE(iq.last(), last);
+ QCOMPARE(iq.last().isNull(), last.isNull());
+ serializePacket(iq, xml);
+}
void TestServer::testConnect()
{
@@ -1720,136 +1845,6 @@ void TestXmlRpc::testResponseFault()
serializePacket(iq, xml);
}
-void TestRsm::testQuery_data()
-{
- QTest::addColumn<QByteArray>("xml");
- QTest::addColumn<int>("max");
- QTest::addColumn<int>("index");
- QTest::addColumn<QString>("before");
- QTest::addColumn<QString>("after");
-
- QTest::newRow("Example 3") <<
- QByteArray("<set xmlns=\"http://jabber.org/protocol/rsm\">"
- "<max>10</max>"
- "</set>")
- << 10 << -1 << QString() << QString();
-
- QTest::newRow("Example 5") <<
- QByteArray("<set xmlns=\"http://jabber.org/protocol/rsm\">"
- "<max>10</max>"
- "<after>peterpan@neverland.lit</after>"
- "</set>")
- << 10 << -1 << QString() << QString("peterpan@neverland.lit");
-
- QTest::newRow("Example 5") <<
- QByteArray("<set xmlns=\"http://jabber.org/protocol/rsm\">"
- "<max>10</max>"
- "<before>peter@pixyland.org</before>"
- "</set>")
- << 10 << -1 << QString("peter@pixyland.org") << QString();
-
- QTest::newRow("Example 11") <<
- QByteArray("<set xmlns=\"http://jabber.org/protocol/rsm\">"
- "<max>10</max>"
- "<before/>"
- "</set>")
- << 10 << -1 << QString("") << QString();
-
- QTest::newRow("Example 12") <<
- QByteArray("<set xmlns=\"http://jabber.org/protocol/rsm\">"
- "<max>10</max>"
- "<index>371</index>"
- "</set>")
- << 10 << 371 << QString() << QString();
-
-
- QTest::newRow("Example 15") <<
- QByteArray("<set xmlns=\"http://jabber.org/protocol/rsm\">"
- "<max>0</max>"
- "</set>")
- << 0 << -1 << QString() << QString();
-}
-
-void TestRsm::testQuery()
-{
- QFETCH(QByteArray, xml);
- QFETCH(int, max);
- QFETCH(int, index);
- QFETCH(QString, before);
- QFETCH(QString, after);
-
- QXmppResultSetQuery iq;
- parsePacket(iq, xml);
- QCOMPARE(iq.max(), max);
- QCOMPARE(iq.index(), index);
- QCOMPARE(iq.before(), before);
- QCOMPARE(iq.before().isNull(), before.isNull());
- QCOMPARE(iq.after(), after);
- QCOMPARE(iq.after().isNull(), after.isNull());
- serializePacket(iq, xml);
-}
-
-void TestRsm::testReply_data()
-{
- QTest::addColumn<QByteArray>("xml");
- QTest::addColumn<int>("count");
- QTest::addColumn<int>("index");
- QTest::addColumn<QString>("first");
- QTest::addColumn<QString>("last");
-
- QTest::newRow("Example 4") <<
- QByteArray( "<set xmlns=\"http://jabber.org/protocol/rsm\">"
- "<first index=\"0\">stpeter@jabber.org</first>"
- "<last>peterpan@neverland.lit</last>"
- "<count>800</count>"
- "</set>")
- << 800 << 0 << QString("stpeter@jabber.org") << QString("peterpan@neverland.lit");
-
- QTest::newRow("Example 6") <<
- QByteArray( "<set xmlns=\"http://jabber.org/protocol/rsm\">"
- "<first index=\"0\">stpeter@jabber.org</first>"
- "<last>peterpan@neverland.lit</last>"
- "<count>800</count>"
- "</set>")
- << 800 << 0 << QString("stpeter@jabber.org") << QString("peterpan@neverland.lit");
- QTest::newRow("Example 4") <<
- QByteArray( "<set xmlns=\"http://jabber.org/protocol/rsm\">"
- "<first index=\"10\">peter@pixyland.org</first>"
- "<last>peter@rabbit.lit</last>"
- "<count>800</count>"
- "</set>")
- << 800 << 10 << QString("peter@pixyland.org") << QString("peter@rabbit.lit");
-
- QTest::newRow("Example 7") <<
- QByteArray( "<set xmlns=\"http://jabber.org/protocol/rsm\">"
- "<count>790</count>"
- "</set>")
- << 790 << -1 << QString() << QString();
-}
-
-
-void TestRsm::testReply()
-{
- QFETCH(QByteArray, xml);
- QFETCH(int, count);
- QFETCH(int, index);
- QFETCH(QString, first);
- QFETCH(QString, last);
-
- QXmppResultSetReply iq;
- parsePacket(iq, xml);
- QCOMPARE(iq.count(), count);
- QCOMPARE(iq.index(), index);
- QCOMPARE(iq.first(), first);
- QCOMPARE(iq.first().isNull(), first.isNull());
- QCOMPARE(iq.last(), last);
- QCOMPARE(iq.last().isNull(), last.isNull());
- serializePacket(iq, xml);
-}
-
-
-
-
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
@@ -1875,6 +1870,9 @@ int main(int argc, char *argv[])
TestPubSub testPubSub;
errors += QTest::qExec(&testPubSub);
+ TestRsm testRsm;
+ errors += QTest::qExec(&testRsm);
+
TestRtp testRtp;
errors += QTest::qExec(&testRtp);
@@ -1887,9 +1885,6 @@ int main(int argc, char *argv[])
TestXmlRpc testXmlRpc;
errors += QTest::qExec(&testXmlRpc);
- TestRsm testRsm;
- errors += QTest::qExec(&testRsm);
-
if (errors)
{
qWarning() << "Total failed tests:" << errors;