From b7b7af761e4fe3f35bd8073e652a93b2559a4160 Mon Sep 17 00:00:00 2001 From: Jeremy Lainé Date: Mon, 1 Oct 2012 13:51:47 +0200 Subject: split QXmppDiscoveryIq tests --- tests/all/tests.cpp | 63 ---------------- tests/qxmppdiscoveryiq/qxmppdiscoveryiq.pro | 3 + tests/qxmppdiscoveryiq/tst_qxmppdiscoveryiq.cpp | 99 +++++++++++++++++++++++++ tests/tests.pro | 1 + 4 files changed, 103 insertions(+), 63 deletions(-) create mode 100644 tests/qxmppdiscoveryiq/qxmppdiscoveryiq.pro create mode 100644 tests/qxmppdiscoveryiq/tst_qxmppdiscoveryiq.cpp (limited to 'tests') diff --git a/tests/all/tests.cpp b/tests/all/tests.cpp index 2731ea9c..f79be52b 100644 --- a/tests/all/tests.cpp +++ b/tests/all/tests.cpp @@ -22,7 +22,6 @@ * */ -#include "QXmppDiscoveryIq.h" #include "QXmppEntityTimeIq.h" #include "QXmppNonSASLAuth.h" #include "QXmppSessionIq.h" @@ -36,8 +35,6 @@ class TestPackets : public QObject Q_OBJECT private slots: - void testDiscovery(); - void testDiscoveryWithForm(); void testNonSaslAuth(); void testSession(); void testStreamFeatures(); @@ -47,66 +44,6 @@ private slots: void testEntityTimeResult(); }; -void TestPackets::testDiscovery() -{ - const QByteArray xml( - "" - "" - "" - "" - "" - "" - "" - "" - ""); - - QXmppDiscoveryIq disco; - parsePacket(disco, xml); - QCOMPARE(disco.verificationString(), QByteArray::fromBase64("QgayPKawpkPSDYmwT/WM94uAlu0=")); - serializePacket(disco, xml); -} - -void TestPackets::testDiscoveryWithForm() -{ - const QByteArray xml( - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "urn:xmpp:dataforms:softwareinfo" - "" - "" - "ipv4" - "ipv6" - "" - "" - "Mac" - "" - "" - "10.5.1" - "" - "" - "Psi" - "" - "" - "0.11" - "" - "" - "" - ""); - - QXmppDiscoveryIq disco; - parsePacket(disco, xml); - QCOMPARE(disco.verificationString(), QByteArray::fromBase64("q07IKJEyjvHSyhy//CH0CxmKi8w=")); - serializePacket(disco, xml); -} - void TestPackets::testNonSaslAuth() { // Client Requests Authentication Fields from Server diff --git a/tests/qxmppdiscoveryiq/qxmppdiscoveryiq.pro b/tests/qxmppdiscoveryiq/qxmppdiscoveryiq.pro new file mode 100644 index 00000000..01016e8c --- /dev/null +++ b/tests/qxmppdiscoveryiq/qxmppdiscoveryiq.pro @@ -0,0 +1,3 @@ +include(../tests.pri) +TARGET = tst_qxmppdiscoveryiq +SOURCES += tst_qxmppdiscoveryiq.cpp diff --git a/tests/qxmppdiscoveryiq/tst_qxmppdiscoveryiq.cpp b/tests/qxmppdiscoveryiq/tst_qxmppdiscoveryiq.cpp new file mode 100644 index 00000000..040a7335 --- /dev/null +++ b/tests/qxmppdiscoveryiq/tst_qxmppdiscoveryiq.cpp @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2008-2012 The QXmpp developers + * + * Authors: + * Jeremy Lainé + * Manjeet Dahiya + * + * 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 +#include "QXmppDiscoveryIq.h" +#include "util.h" + +class tst_QXmppDiscoveryIq : public QObject +{ + Q_OBJECT + +private slots: + void testDiscovery(); + void testDiscoveryWithForm(); +}; + +void tst_QXmppDiscoveryIq::testDiscovery() +{ + const QByteArray xml( + "" + "" + "" + "" + "" + "" + "" + "" + ""); + + QXmppDiscoveryIq disco; + parsePacket(disco, xml); + QCOMPARE(disco.verificationString(), QByteArray::fromBase64("QgayPKawpkPSDYmwT/WM94uAlu0=")); + serializePacket(disco, xml); +} + +void tst_QXmppDiscoveryIq::testDiscoveryWithForm() +{ + const QByteArray xml( + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "urn:xmpp:dataforms:softwareinfo" + "" + "" + "ipv4" + "ipv6" + "" + "" + "Mac" + "" + "" + "10.5.1" + "" + "" + "Psi" + "" + "" + "0.11" + "" + "" + "" + ""); + + QXmppDiscoveryIq disco; + parsePacket(disco, xml); + QCOMPARE(disco.verificationString(), QByteArray::fromBase64("q07IKJEyjvHSyhy//CH0CxmKi8w=")); + serializePacket(disco, xml); +} + +QTEST_MAIN(tst_QXmppDiscoveryIq) +#include "tst_qxmppdiscoveryiq.moc" diff --git a/tests/tests.pro b/tests/tests.pro index 3958e705..d1d9d235 100644 --- a/tests/tests.pro +++ b/tests/tests.pro @@ -4,6 +4,7 @@ SUBDIRS = \ qxmpparchiveiq \ qxmppbindiq \ qxmppdataform \ + qxmppdiscoveryiq \ qxmppiq \ qxmppjingleiq \ qxmppmessage \ -- cgit v1.2.3