diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-08-26 10:38:35 +0000 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2010-08-26 10:38:35 +0000 |
| commit | d4c0573bbd8336576126417ad325bf04f0f5a753 (patch) | |
| tree | 23a8ed7a76e542d58974dbbd6d4a133d09a3c075 /tests/tests.cpp | |
| parent | a193757a370db7bf590e223a282aad108488724d (diff) | |
| download | qxmpp-d4c0573bbd8336576126417ad325bf04f0f5a753.tar.gz | |
test JID utility functions
Diffstat (limited to 'tests/tests.cpp')
| -rw-r--r-- | tests/tests.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/tests.cpp b/tests/tests.cpp index 21021409..f71e3989 100644 --- a/tests/tests.cpp +++ b/tests/tests.cpp @@ -80,6 +80,29 @@ void TestUtils::testHmac() QCOMPARE(hmac, QByteArray::fromHex("56be34521d144c88dbb8c733f0e8b3f6")); } +void TestUtils::testJid() +{ + QCOMPARE(jidToBareJid("foo@example.com/resource"), QLatin1String("foo@example.com")); + QCOMPARE(jidToBareJid("foo@example.com"), QLatin1String("foo@example.com")); + QCOMPARE(jidToBareJid("example.com"), QLatin1String("example.com")); + QCOMPARE(jidToBareJid(QString()), QString()); + + QCOMPARE(jidToDomain("foo@example.com/resource"), QLatin1String("example.com")); + QCOMPARE(jidToDomain("foo@example.com"), QLatin1String("example.com")); + QCOMPARE(jidToDomain("example.com"), QLatin1String("example.com")); + QCOMPARE(jidToDomain(QString()), QString()); + + QCOMPARE(jidToResource("foo@example.com/resource"), QLatin1String("resource")); + QCOMPARE(jidToResource("foo@example.com"), QString()); + QCOMPARE(jidToResource("example.com"), QString()); + QCOMPARE(jidToResource(QString()), QString()); + + QCOMPARE(jidToUser("foo@example.com/resource"), QLatin1String("foo")); + QCOMPARE(jidToUser("foo@example.com"), QLatin1String("foo")); + QCOMPARE(jidToUser("example.com"), QString()); + QCOMPARE(jidToUser(QString()), QString()); +} + template <class T> static void parsePacket(T &packet, const QByteArray &xml) { |
