diff options
Diffstat (limited to 'Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp')
m--------- | Swiften | 0 | ||||
-rw-r--r-- | Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp | 64 |
2 files changed, 0 insertions, 64 deletions
diff --git a/Swiften b/Swiften new file mode 160000 +Subproject 8213ba16d0043d2461f4b031c881d61dda5a38c diff --git a/Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp deleted file mode 100644 index 3fbf27a..0000000 --- a/Swiften/Parser/PayloadParsers/UnitTest/StorageParserTest.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> - -#include "Swiften/Parser/PayloadParsers/StorageParser.h" -#include "Swiften/Parser/PayloadParsers/UnitTest/PayloadsParserTester.h" - -using namespace Swift; - -class StorageParserTest : public CppUnit::TestFixture { - CPPUNIT_TEST_SUITE(StorageParserTest); - CPPUNIT_TEST(testParse_Conference); - CPPUNIT_TEST(testParse_MultipleConferences); - CPPUNIT_TEST_SUITE_END(); - - public: - StorageParserTest() {} - - void testParse_Conference() { - PayloadsParserTester parser; - - CPPUNIT_ASSERT(parser.parse( - "<storage xmlns='storage:bookmarks'>" - "<conference " - "name='Council of Oberon' " - "autojoin='true' jid='council@conference.underhill.org'>" - "<nick>Puck</nick>" - "<password>MyPass</password>" - "</conference>" - "</storage>")); - - Storage* payload = dynamic_cast<Storage*>(parser.getPayload().get()); - std::vector<Storage::Conference> conferences = payload->getConferences(); - CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(conferences.size())); - CPPUNIT_ASSERT_EQUAL(String("Council of Oberon"), conferences[0].name); - CPPUNIT_ASSERT_EQUAL(JID("council@conference.underhill.org"), conferences[0].jid); - CPPUNIT_ASSERT(conferences[0].autoJoin); - CPPUNIT_ASSERT_EQUAL(String("Puck"), conferences[0].nick); - CPPUNIT_ASSERT_EQUAL(String("MyPass"), conferences[0].password); - } - - void testParse_MultipleConferences() { - PayloadsParserTester parser; - - CPPUNIT_ASSERT(parser.parse( - "<storage xmlns='storage:bookmarks'>" - "<conference " - "name='Council of Oberon' " - "jid='council@conference.underhill.org' />" - "<conference " - "name='Tea party' " - "jid='teaparty@wonderland.lit' />" - "</storage>")); - - Storage* payload = dynamic_cast<Storage*>(parser.getPayload().get()); - std::vector<Storage::Conference> conferences = payload->getConferences(); - CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(conferences.size())); - CPPUNIT_ASSERT_EQUAL(String("Council of Oberon"), conferences[0].name); - CPPUNIT_ASSERT_EQUAL(JID("council@conference.underhill.org"), conferences[0].jid); - CPPUNIT_ASSERT_EQUAL(String("Tea party"), conferences[1].name); - CPPUNIT_ASSERT_EQUAL(JID("teaparty@wonderland.lit"), conferences[1].jid); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(StorageParserTest); |