diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-10-15 16:15:57 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-10-15 16:15:57 (GMT) |
commit | 062658db9f46ef749eeec09c162e5afaf1524ab6 (patch) | |
tree | 12ea883e39c7d938310ea715c71127bc1801319c /Swiften/Parser/UnitTest | |
parent | f52aa93c3d6d5976b072d31f3d3336beb1596ece (diff) | |
download | swift-contrib-062658db9f46ef749eeec09c162e5afaf1524ab6.zip swift-contrib-062658db9f46ef749eeec09c162e5afaf1524ab6.tar.bz2 |
Added Component parser, serializer, element, and connector.
Diffstat (limited to 'Swiften/Parser/UnitTest')
-rw-r--r-- | Swiften/Parser/UnitTest/XMPPParserTest.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/Swiften/Parser/UnitTest/XMPPParserTest.cpp b/Swiften/Parser/UnitTest/XMPPParserTest.cpp index cd42b90..90a4b03 100644 --- a/Swiften/Parser/UnitTest/XMPPParserTest.cpp +++ b/Swiften/Parser/UnitTest/XMPPParserTest.cpp @@ -22,8 +22,7 @@ using namespace Swift; -class XMPPParserTest : public CppUnit::TestFixture -{ +class XMPPParserTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(XMPPParserTest); CPPUNIT_TEST(testParse_SimpleSession); CPPUNIT_TEST(testParse_SimpleClientFromServerSession); @@ -37,8 +36,6 @@ class XMPPParserTest : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: - XMPPParserTest() {} - void testParse_SimpleSession() { XMPPParser testling(&client_, &factories_); @@ -51,7 +48,7 @@ class XMPPParserTest : public CppUnit::TestFixture CPPUNIT_ASSERT_EQUAL(5, static_cast<int>(client_.events.size())); CPPUNIT_ASSERT_EQUAL(Client::StreamStart, client_.events[0].type); - CPPUNIT_ASSERT_EQUAL(String("example.com"), client_.events[0].to); + CPPUNIT_ASSERT_EQUAL(String("example.com"), client_.events[0].header->getTo()); CPPUNIT_ASSERT_EQUAL(Client::ElementEvent, client_.events[1].type); CPPUNIT_ASSERT_EQUAL(Client::ElementEvent, client_.events[2].type); CPPUNIT_ASSERT_EQUAL(Client::ElementEvent, client_.events[3].type); @@ -66,8 +63,8 @@ class XMPPParserTest : public CppUnit::TestFixture CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(client_.events.size())); CPPUNIT_ASSERT_EQUAL(Client::StreamStart, client_.events[0].type); - CPPUNIT_ASSERT_EQUAL(String("example.com"), client_.events[0].from); - CPPUNIT_ASSERT_EQUAL(String("aeab"), client_.events[0].id); + CPPUNIT_ASSERT_EQUAL(String("example.com"), client_.events[0].header->getFrom()); + CPPUNIT_ASSERT_EQUAL(String("aeab"), client_.events[0].header->getID()); } @@ -159,21 +156,19 @@ class XMPPParserTest : public CppUnit::TestFixture struct Event { Event(Type type, boost::shared_ptr<Element> element) : type(type), element(element) {} - Event(Type type, const String& from, const String& to, const String& id) : type(type), from(from), to(to), id(id) {} + Event(Type type, const ProtocolHeader& header) : type(type), header(header) {} Event(Type type) : type(type) {} Type type; - String from; - String to; - String id; + boost::optional<ProtocolHeader> header; boost::shared_ptr<Element> element; }; Client() {} void handleStreamStart(const ProtocolHeader& header) { - events.push_back(Event(StreamStart, header.getFrom(), header.getTo(), header.getID())); + events.push_back(Event(StreamStart, header)); } void handleElement(boost::shared_ptr<Element> element) { |