diff options
Diffstat (limited to 'Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp')
m--------- | Swiften | 0 | ||||
-rw-r--r-- | Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp | 50 |
2 files changed, 0 insertions, 50 deletions
diff --git a/Swiften b/Swiften new file mode 160000 +Subproject 8213ba16d0043d2461f4b031c881d61dda5a38c diff --git a/Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp deleted file mode 100644 index 4c8db07..0000000 --- a/Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Parser/PayloadParsers/RosterParser.h" -#include "Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h" - -using namespace Swift; - -class RosterParserTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(RosterParserTest); - CPPUNIT_TEST(testParse); - CPPUNIT_TEST_SUITE_END(); - - public: - RosterParserTest() {} - - void testParse() { - PayloadsParserTester parser; - parser.parse( - "<query xmlns='jabber:iq:roster'>" - " <item jid='foo@bar.com' name='Foo @ Bar' subscription='from' ask='subscribe'>" - " <group>Group 1</group>" - " <group>Group 2</group>" - " </item>" - " <item jid='baz@blo.com' name='Baz'/>" - "</query>"); - - RosterPayload* payload = dynamic_cast<RosterPayload*>(parser.getPayload().get()); - const RosterPayload::RosterItemPayloads& items = payload->getItems(); - - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), items.size()); - - CPPUNIT_ASSERT_EQUAL(JID("foo@bar.com"), items[0].getJID()); - CPPUNIT_ASSERT_EQUAL(String("Foo @ Bar"), items[0].getName()); - CPPUNIT_ASSERT_EQUAL(RosterItemPayload::From, items[0].getSubscription()); - CPPUNIT_ASSERT(items[0].getSubscriptionRequested()); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(2), items[0].getGroups().size()); - CPPUNIT_ASSERT_EQUAL(String("Group 1"), items[0].getGroups()[0]); - CPPUNIT_ASSERT_EQUAL(String("Group 2"), items[0].getGroups()[1]); - - CPPUNIT_ASSERT_EQUAL(JID("baz@blo.com"), items[1].getJID()); - CPPUNIT_ASSERT_EQUAL(String("Baz"), items[1].getName()); - CPPUNIT_ASSERT_EQUAL(RosterItemPayload::None, items[1].getSubscription()); - CPPUNIT_ASSERT(!items[1].getSubscriptionRequested()); - CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), items[1].getGroups().size()); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(RosterParserTest); |