summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-01-21 18:36:11 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-01-21 18:36:11 (GMT)
commit739e16ab8fa21f22b8ddf827b0979e71bf613e78 (patch)
tree91bf9bad8e8ade3aa9484fc01dff0221addb4cbe /Swiften/Parser/PayloadParsers
parentc632dffabdd3387547bd07cd96754deab47703bc (diff)
downloadswift-739e16ab8fa21f22b8ddf827b0979e71bf613e78.zip
swift-739e16ab8fa21f22b8ddf827b0979e71bf613e78.tar.bz2
Code cleanup.
Diffstat (limited to 'Swiften/Parser/PayloadParsers')
-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
4 files changed, 11 insertions, 19 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();