diff options
Diffstat (limited to 'tests/qxmpputils/tst_qxmpputils.cpp')
| -rw-r--r-- | tests/qxmpputils/tst_qxmpputils.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/qxmpputils/tst_qxmpputils.cpp b/tests/qxmpputils/tst_qxmpputils.cpp index 27424e1a..f879ba3a 100644 --- a/tests/qxmpputils/tst_qxmpputils.cpp +++ b/tests/qxmpputils/tst_qxmpputils.cpp @@ -37,6 +37,7 @@ private slots: void testJid(); void testMime(); void testTimezoneOffset(); + void testStanzaHash(); }; void tst_QXmppUtils::testCrc32() @@ -127,5 +128,21 @@ void tst_QXmppUtils::testTimezoneOffset() QCOMPARE(QXmppUtils::timezoneOffsetToString(-5400), QLatin1String("-01:30")); } +void tst_QXmppUtils::testStanzaHash() +{ + for (int i = 0; i < 100; i++) { + const QString hash = QXmppUtils::generateStanzaHash(i); + QCOMPARE(hash.size(), i); + + if (i == 36) { + QCOMPARE(hash.count('-'), 4); + } + } + + const QString hash = QXmppUtils::generateStanzaUuid(); + QCOMPARE(hash.size(), 36); + QCOMPARE(hash.count('-'), 4); +} + QTEST_MAIN(tst_QXmppUtils) #include "tst_qxmpputils.moc" |
