diff options
author | Richard Maudsley <richard.maudsley@isode.com> | 2014-02-25 13:19:11 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2014-04-24 13:06:33 (GMT) |
commit | e4704555946626980014d936dcfe6ede2710501b (patch) | |
tree | 59d0db1bad3d4a0f74c89da8834b2002369c3b4b /Swiften/Parser/PayloadParsers/UnitTest/MAMArchivedParserTest.cpp | |
parent | 09e9713028b728fad9050c4e20180cc96c4572ce (diff) | |
download | swift-e4704555946626980014d936dcfe6ede2710501b.zip swift-e4704555946626980014d936dcfe6ede2710501b.tar.bz2 |
Added MAM parsers, serializers and tests.
Change-Id: I589a7c65664bfecfd0ac34240600dcccb4cbd40e
Diffstat (limited to 'Swiften/Parser/PayloadParsers/UnitTest/MAMArchivedParserTest.cpp')
-rw-r--r-- | Swiften/Parser/PayloadParsers/UnitTest/MAMArchivedParserTest.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/MAMArchivedParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/MAMArchivedParserTest.cpp new file mode 100644 index 0000000..3e65cc6 --- /dev/null +++ b/Swiften/Parser/PayloadParsers/UnitTest/MAMArchivedParserTest.cpp @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2014 Kevin Smith and Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/extensions/TestFactoryRegistry.h> + +#include <Swiften/Base/DateTime.h> +#include <Swiften/Parser/PayloadParsers/MAMArchivedParser.h> +#include <Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h> + +using namespace Swift; + +class MAMArchivedParserTest : public CppUnit::TestFixture +{ + CPPUNIT_TEST_SUITE(MAMArchivedParserTest); + CPPUNIT_TEST(testParse); + CPPUNIT_TEST_SUITE_END(); + + public: + void testParse() { + PayloadsParserTester parser; + CPPUNIT_ASSERT(parser.parse( + "<archived by=\"juliet@capulet.lit\" id=\"28482-98726-73623\" xmlns=\"urn:xmpp:mam:0\"/>")); + + boost::shared_ptr<MAMArchived> payload = parser.getPayload<MAMArchived>(); + CPPUNIT_ASSERT(!!payload); + CPPUNIT_ASSERT_EQUAL(JID("juliet@capulet.lit"), payload->getBy()); + CPPUNIT_ASSERT_EQUAL(std::string("28482-98726-73623"), payload->getID()); + } +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(MAMArchivedParserTest); |