summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Parser')
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp9
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp7
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp4
-rw-r--r--Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp10
-rw-r--r--Swiften/Parser/UnitTest/IQParserTest.cpp5
-rw-r--r--Swiften/Parser/UnitTest/MessageParserTest.cpp5
-rw-r--r--Swiften/Parser/UnitTest/PresenceParserTest.cpp5
-rw-r--r--Swiften/Parser/UnitTest/StanzaParserTest.cpp5
-rw-r--r--Swiften/Parser/UnitTest/StreamFeaturesParserTest.cpp11
9 files changed, 19 insertions, 42 deletions
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp
index 79b28db..5d9e365 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/DiscoInfoParserTest.cpp
@@ -12,16 +12,13 @@
using namespace Swift;
-class DiscoInfoParserTest : public CppUnit::TestFixture
-{
+class DiscoInfoParserTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(DiscoInfoParserTest);
CPPUNIT_TEST(testParse);
CPPUNIT_TEST(testParse_Form);
CPPUNIT_TEST_SUITE_END();
public:
- DiscoInfoParserTest() {}
-
void testParse() {
PayloadsParserTester parser;
@@ -34,7 +31,7 @@ class DiscoInfoParserTest : public CppUnit::TestFixture
"<feature var=\"baz-feature\"/>"
"</query>"));
- DiscoInfo* payload = dynamic_cast<DiscoInfo*>(parser.getPayload().get());
+ DiscoInfo::ref payload = boost::dynamic_pointer_cast<DiscoInfo>(parser.getPayload());
CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(payload->getIdentities().size()));
CPPUNIT_ASSERT_EQUAL(String("Swift"), payload->getIdentities()[0].getName());
CPPUNIT_ASSERT_EQUAL(String("pc"), payload->getIdentities()[0].getType());
@@ -63,7 +60,7 @@ class DiscoInfoParserTest : public CppUnit::TestFixture
"<feature var=\"bar-feature\"/>"
"</query>"));
- DiscoInfo* payload = dynamic_cast<DiscoInfo*>(parser.getPayload().get());
+ DiscoInfo::ref payload = boost::dynamic_pointer_cast<DiscoInfo>(parser.getPayload());
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(payload->getExtensions().size()));
CPPUNIT_ASSERT_EQUAL(String("Bot Configuration"), payload->getExtensions()[0]->getTitle());
CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(payload->getFeatures().size()));
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp
index be6b503..618ce6d 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/ErrorParserTest.cpp
@@ -12,15 +12,12 @@
using namespace Swift;
-class ErrorParserTest : public CppUnit::TestFixture
-{
+class ErrorParserTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(ErrorParserTest);
CPPUNIT_TEST(testParse);
CPPUNIT_TEST_SUITE_END();
public:
- ErrorParserTest() {}
-
void testParse() {
PayloadsParserTester parser;
@@ -30,7 +27,7 @@ class ErrorParserTest : public CppUnit::TestFixture
"<text xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\">boo</text>"
"</error>"));
- ErrorPayload* payload = dynamic_cast<ErrorPayload*>(parser.getPayload().get());
+ ErrorPayload::ref payload = boost::dynamic_pointer_cast<ErrorPayload>(parser.getPayload());
CPPUNIT_ASSERT_EQUAL(ErrorPayload::BadRequest, payload->getCondition());
CPPUNIT_ASSERT_EQUAL(ErrorPayload::Modify, payload->getType());
CPPUNIT_ASSERT_EQUAL(String("boo"), payload->getText());
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp
index b340739..68a2e4f 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/PriorityParserTest.cpp
@@ -24,7 +24,7 @@ class PriorityParserTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT(parser.parse("<priority>-120</priority>"));
- Priority* payload = dynamic_cast<Priority*>(parser.getPayload().get());
+ Priority::ref payload = boost::dynamic_pointer_cast<Priority>(parser.getPayload());
CPPUNIT_ASSERT_EQUAL(-120, payload->getPriority());
}
@@ -33,7 +33,7 @@ class PriorityParserTest : public CppUnit::TestFixture {
CPPUNIT_ASSERT(parser.parse("<priority>invalid</priority>"));
- Priority* payload = dynamic_cast<Priority*>(parser.getPayload().get());
+ Priority::ref payload = boost::dynamic_pointer_cast<Priority>(parser.getPayload());
CPPUNIT_ASSERT_EQUAL(0, payload->getPriority());
}
};
diff --git a/Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp b/Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp
index aea9dc4..b55a340 100644
--- a/Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp
+++ b/Swiften/Parser/PayloadParsers/UnitTest/RosterParserTest.cpp
@@ -20,18 +20,16 @@ class RosterParserTest : public CppUnit::TestFixture
CPPUNIT_TEST_SUITE_END();
public:
- RosterParserTest() {}
-
void testParse() {
PayloadsParserTester parser;
- parser.parse(
+ CPPUNIT_ASSERT(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>");
+ "</query>"));
RosterPayload* payload = dynamic_cast<RosterPayload*>(parser.getPayload().get());
const RosterPayload::RosterItemPayloads& items = payload->getItems();
@@ -55,7 +53,7 @@ class RosterParserTest : public CppUnit::TestFixture
void testParse_ItemWithUnknownContent() {
PayloadsParserTester parser;
- parser.parse(
+ CPPUNIT_ASSERT(parser.parse(
"<query xmlns='jabber:iq:roster'>"
" <item jid='foo@bar.com' name='Foo @ Bar' subscription='from' ask='subscribe'>"
" <group>Group 1</group>"
@@ -63,7 +61,7 @@ class RosterParserTest : public CppUnit::TestFixture
" <group>Group 2</group>"
" <baz><fum>foo</fum></baz>"
" </item>"
- "</query>");
+ "</query>"));
RosterPayload* payload = dynamic_cast<RosterPayload*>(parser.getPayload().get());
const RosterPayload::RosterItemPayloads& items = payload->getItems();
diff --git a/Swiften/Parser/UnitTest/IQParserTest.cpp b/Swiften/Parser/UnitTest/IQParserTest.cpp
index 427d32e..3cc7d45 100644
--- a/Swiften/Parser/UnitTest/IQParserTest.cpp
+++ b/Swiften/Parser/UnitTest/IQParserTest.cpp
@@ -13,8 +13,7 @@
using namespace Swift;
-class IQParserTest : public CppUnit::TestFixture
-{
+class IQParserTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(IQParserTest);
CPPUNIT_TEST(testParse_Set);
CPPUNIT_TEST(testParse_Get);
@@ -23,8 +22,6 @@ class IQParserTest : public CppUnit::TestFixture
CPPUNIT_TEST_SUITE_END();
public:
- IQParserTest() {}
-
void setUp() {
factoryCollection_ = new PayloadParserFactoryCollection();
}
diff --git a/Swiften/Parser/UnitTest/MessageParserTest.cpp b/Swiften/Parser/UnitTest/MessageParserTest.cpp
index de9e858..7615fa3 100644
--- a/Swiften/Parser/UnitTest/MessageParserTest.cpp
+++ b/Swiften/Parser/UnitTest/MessageParserTest.cpp
@@ -13,8 +13,7 @@
using namespace Swift;
-class MessageParserTest : public CppUnit::TestFixture
-{
+class MessageParserTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(MessageParserTest);
CPPUNIT_TEST(testParse_Normal);
CPPUNIT_TEST(testParse_Chat);
@@ -24,8 +23,6 @@ class MessageParserTest : public CppUnit::TestFixture
CPPUNIT_TEST_SUITE_END();
public:
- MessageParserTest() {}
-
void setUp() {
factoryCollection_ = new PayloadParserFactoryCollection();
}
diff --git a/Swiften/Parser/UnitTest/PresenceParserTest.cpp b/Swiften/Parser/UnitTest/PresenceParserTest.cpp
index ba7c2d9..f68db40 100644
--- a/Swiften/Parser/UnitTest/PresenceParserTest.cpp
+++ b/Swiften/Parser/UnitTest/PresenceParserTest.cpp
@@ -13,8 +13,7 @@
using namespace Swift;
-class PresenceParserTest : public CppUnit::TestFixture
-{
+class PresenceParserTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(PresenceParserTest);
CPPUNIT_TEST(testParse_Available);
CPPUNIT_TEST(testParse_Unavailable);
@@ -27,8 +26,6 @@ class PresenceParserTest : public CppUnit::TestFixture
CPPUNIT_TEST_SUITE_END();
public:
- PresenceParserTest() {}
-
void setUp() {
factoryCollection_ = new PayloadParserFactoryCollection();
}
diff --git a/Swiften/Parser/UnitTest/StanzaParserTest.cpp b/Swiften/Parser/UnitTest/StanzaParserTest.cpp
index 6e51a9f..48d24da 100644
--- a/Swiften/Parser/UnitTest/StanzaParserTest.cpp
+++ b/Swiften/Parser/UnitTest/StanzaParserTest.cpp
@@ -16,8 +16,7 @@
using namespace Swift;
-class StanzaParserTest : public CppUnit::TestFixture
-{
+class StanzaParserTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(StanzaParserTest);
CPPUNIT_TEST(testHandleEndElement_OnePayload);
CPPUNIT_TEST(testHandleEndElement_MultiplePayloads);
@@ -27,8 +26,6 @@ class StanzaParserTest : public CppUnit::TestFixture
CPPUNIT_TEST_SUITE_END();
public:
- StanzaParserTest() {}
-
void setUp() {
factoryCollection_ = new PayloadParserFactoryCollection();
factoryCollection_->addFactory(&factory1_);
diff --git a/Swiften/Parser/UnitTest/StreamFeaturesParserTest.cpp b/Swiften/Parser/UnitTest/StreamFeaturesParserTest.cpp
index 7f5a398..1cdaf54 100644
--- a/Swiften/Parser/UnitTest/StreamFeaturesParserTest.cpp
+++ b/Swiften/Parser/UnitTest/StreamFeaturesParserTest.cpp
@@ -12,16 +12,13 @@
using namespace Swift;
-class StreamFeaturesParserTest : public CppUnit::TestFixture
-{
+class StreamFeaturesParserTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(StreamFeaturesParserTest);
CPPUNIT_TEST(testParse);
CPPUNIT_TEST(testParse_Empty);
CPPUNIT_TEST_SUITE_END();
public:
- StreamFeaturesParserTest() {}
-
void testParse() {
StreamFeaturesParser testling;
ElementParserTester parser(&testling);
@@ -42,7 +39,7 @@ class StreamFeaturesParserTest : public CppUnit::TestFixture
"<session xmlns=\"urn:ietf:params:xml:ns:xmpp-session\"/>"
"</stream:features>"));
- StreamFeatures* element = dynamic_cast<StreamFeatures*>(testling.getElement().get());
+ StreamFeatures::ref element = boost::dynamic_pointer_cast<StreamFeatures>(testling.getElement());
CPPUNIT_ASSERT(element->hasStartTLS());
CPPUNIT_ASSERT(element->hasSession());
CPPUNIT_ASSERT(element->hasResourceBind());
@@ -58,9 +55,9 @@ class StreamFeaturesParserTest : public CppUnit::TestFixture
StreamFeaturesParser testling;
ElementParserTester parser(&testling);
- parser.parse("<stream:features xmlns:stream='http://etherx.jabber.org/streams'/>");
+ CPPUNIT_ASSERT(parser.parse("<stream:features xmlns:stream='http://etherx.jabber.org/streams'/>"));
- StreamFeatures* element = dynamic_cast<StreamFeatures*>(testling.getElement().get());
+ StreamFeatures::ref element = boost::dynamic_pointer_cast<StreamFeatures>(testling.getElement());
CPPUNIT_ASSERT(!element->hasStartTLS());
CPPUNIT_ASSERT(!element->hasSession());
CPPUNIT_ASSERT(!element->hasResourceBind());