diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-04-20 18:48:38 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-04-23 07:53:50 (GMT) |
commit | b6246efcf15f03bb5b44bc79190bc9f4c7be9506 (patch) | |
tree | b85028f8bca17b066512e0bad688b74fb7717a34 /Swiften/Parser/UnitTest | |
parent | b381d4fac4c4362ab534ab73875126cb5c6cd101 (diff) | |
download | swift-contrib-b6246efcf15f03bb5b44bc79190bc9f4c7be9506.zip swift-contrib-b6246efcf15f03bb5b44bc79190bc9f4c7be9506.tar.bz2 |
Finished Stream Management parserialements.
Diffstat (limited to 'Swiften/Parser/UnitTest')
-rw-r--r-- | Swiften/Parser/UnitTest/StreamManagementEnabledParserTest.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Swiften/Parser/UnitTest/StreamManagementEnabledParserTest.cpp b/Swiften/Parser/UnitTest/StreamManagementEnabledParserTest.cpp new file mode 100644 index 0000000..07b7b31 --- /dev/null +++ b/Swiften/Parser/UnitTest/StreamManagementEnabledParserTest.cpp @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2010 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/Parser/StreamManagementEnabledParser.h> +#include <Swiften/Parser/UnitTest/ElementParserTester.h> + +using namespace Swift; + +class StreamManagementEnabledParserTest : public CppUnit::TestFixture { + CPPUNIT_TEST_SUITE(StreamManagementEnabledParserTest); + CPPUNIT_TEST(testParse); + CPPUNIT_TEST_SUITE_END(); + + public: + void testParse() { + StreamManagementEnabledParser testling; + ElementParserTester parser(&testling); + + CPPUNIT_ASSERT(parser.parse( + "<enabled xmlns=\"urn:xmpp:sm:3\" id=\"some-long-sm-id\" resume=\"true\"/>")); + + boost::shared_ptr<StreamManagementEnabled> element = boost::dynamic_pointer_cast<StreamManagementEnabled>(testling.getElement()); + CPPUNIT_ASSERT(element->getResumeSupported()); + CPPUNIT_ASSERT_EQUAL(std::string("some-long-sm-id"), element->getResumeID()); + } +}; + +CPPUNIT_TEST_SUITE_REGISTRATION(StreamManagementEnabledParserTest); |