diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-01-21 18:36:11 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-01-21 18:36:11 (GMT) |
commit | 739e16ab8fa21f22b8ddf827b0979e71bf613e78 (patch) | |
tree | 91bf9bad8e8ade3aa9484fc01dff0221addb4cbe /Swiften | |
parent | c632dffabdd3387547bd07cd96754deab47703bc (diff) | |
download | swift-contrib-739e16ab8fa21f22b8ddf827b0979e71bf613e78.zip swift-contrib-739e16ab8fa21f22b8ddf827b0979e71bf613e78.tar.bz2 |
Code cleanup.
Diffstat (limited to 'Swiften')
25 files changed, 50 insertions, 108 deletions
diff --git a/Swiften/Component/UnitTest/ComponentConnectorTest.cpp b/Swiften/Component/UnitTest/ComponentConnectorTest.cpp index 7d00b09..bfa2cb2 100644 --- a/Swiften/Component/UnitTest/ComponentConnectorTest.cpp +++ b/Swiften/Component/UnitTest/ComponentConnectorTest.cpp @@ -32,10 +32,9 @@ class ComponentConnectorTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE_END(); public: - ComponentConnectorTest() : host1("1.1.1.1"), host2("2.2.2.2") { - } - void setUp() { + host1 = HostAddress("1.1.1.1"); + host2 = HostAddress("2.2.2.2"); eventLoop = new DummyEventLoop(); resolver = new StaticDomainNameResolver(eventLoop); connectionFactory = new MockConnectionFactory(eventLoop); diff --git a/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp b/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp index 1b2e54b..988065f 100644 --- a/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp +++ b/Swiften/Disco/UnitTest/DiscoInfoResponderTest.cpp @@ -22,8 +22,6 @@ class DiscoInfoResponderTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE_END(); public: - DiscoInfoResponderTest() {} - void setUp() { channel_ = new DummyIQChannel(); router_ = new IQRouter(channel_); diff --git a/Swiften/Elements/Priority.h b/Swiften/Elements/Priority.h index eb4683f..12181d4 100644 --- a/Swiften/Elements/Priority.h +++ b/Swiften/Elements/Priority.h @@ -4,14 +4,15 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#ifndef SWIFTEN_Priority_H -#define SWIFTEN_Priority_H +#pragma once #include "Swiften/Elements/Payload.h" namespace Swift { class Priority : public Payload { public: + typedef boost::shared_ptr<Priority> ref; + Priority(int priority = 0) : priority_(priority) { } @@ -27,5 +28,3 @@ namespace Swift { int priority_; }; } - -#endif diff --git a/Swiften/Elements/StreamFeatures.h b/Swiften/Elements/StreamFeatures.h index d8a6af7..32446ce 100644 --- a/Swiften/Elements/StreamFeatures.h +++ b/Swiften/Elements/StreamFeatures.h @@ -4,8 +4,7 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#ifndef SWIFTEN_StreamFeatures_H -#define SWIFTEN_StreamFeatures_H +#pragma once #include <vector> #include <algorithm> @@ -14,9 +13,10 @@ #include "Swiften/Elements/Element.h" namespace Swift { - class StreamFeatures : public Element - { + class StreamFeatures : public Element { public: + typedef boost::shared_ptr<StreamFeatures> ref; + StreamFeatures() : hasStartTLS_(false), hasResourceBind_(false), hasSession_(false), hasStreamManagement_(false) {} void setHasStartTLS() { @@ -88,5 +88,3 @@ namespace Swift { bool hasStreamManagement_; }; } - -#endif diff --git a/Swiften/EventLoop/UnitTest/SimpleEventLoopTest.cpp b/Swiften/EventLoop/UnitTest/SimpleEventLoopTest.cpp index fd40ee9..471fec5 100644 --- a/Swiften/EventLoop/UnitTest/SimpleEventLoopTest.cpp +++ b/Swiften/EventLoop/UnitTest/SimpleEventLoopTest.cpp @@ -14,16 +14,13 @@ using namespace Swift; -class SimpleEventLoopTest : public CppUnit::TestFixture -{ +class SimpleEventLoopTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(SimpleEventLoopTest); CPPUNIT_TEST(testRun); CPPUNIT_TEST(testPostFromMainThread); CPPUNIT_TEST_SUITE_END(); public: - SimpleEventLoopTest() {} - void setUp() { counter_ = 0; } diff --git a/Swiften/LinkLocal/UnitTest/LinkLocalServiceBrowserTest.cpp b/Swiften/LinkLocal/UnitTest/LinkLocalServiceBrowserTest.cpp index d55603c..9c4c288 100644 --- a/Swiften/LinkLocal/UnitTest/LinkLocalServiceBrowserTest.cpp +++ b/Swiften/LinkLocal/UnitTest/LinkLocalServiceBrowserTest.cpp @@ -40,8 +40,6 @@ class LinkLocalServiceBrowserTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE_END(); public: - LinkLocalServiceBrowserTest() {} - void setUp() { eventLoop = new DummyEventLoop(); querier = boost::shared_ptr<FakeDNSSDQuerier>(new FakeDNSSDQuerier("wonderland.lit", eventLoop)); diff --git a/Swiften/Network/UnitTest/ConnectorTest.cpp b/Swiften/Network/UnitTest/ConnectorTest.cpp index a71d4b7..c8aa9a9 100644 --- a/Swiften/Network/UnitTest/ConnectorTest.cpp +++ b/Swiften/Network/UnitTest/ConnectorTest.cpp @@ -38,10 +38,10 @@ class ConnectorTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE_END(); public: - ConnectorTest() : host1(HostAddress("1.1.1.1"), 1234), host2(HostAddress("2.2.2.2"), 2345), host3(HostAddress("3.3.3.3"), 5222) { - } - void setUp() { + host1 = HostAddressPort(HostAddress("1.1.1.1"), 1234); + host2 = HostAddressPort(HostAddress("2.2.2.2"), 2345); + host3 = HostAddressPort(HostAddress("3.3.3.3"), 5222); eventLoop = new DummyEventLoop(); resolver = new StaticDomainNameResolver(eventLoop); connectionFactory = new MockConnectionFactory(eventLoop); 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()); diff --git a/Swiften/QA/NetworkTest/BoostConnectionTest.cpp b/Swiften/QA/NetworkTest/BoostConnectionTest.cpp index 7259807..543689d 100644 --- a/Swiften/QA/NetworkTest/BoostConnectionTest.cpp +++ b/Swiften/QA/NetworkTest/BoostConnectionTest.cpp @@ -32,8 +32,6 @@ class BoostConnectionTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE_END(); public: - BoostConnectionTest() {} - void setUp() { boostIOServiceThread_ = new BoostIOServiceThread(); eventLoop_ = new DummyEventLoop(); diff --git a/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp b/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp index d0e0a43..b0316fe 100644 --- a/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp +++ b/Swiften/QA/NetworkTest/DomainNameResolverTest.cpp @@ -40,8 +40,6 @@ class DomainNameResolverTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE_END(); public: - DomainNameResolverTest() {} - void setUp() { eventLoop = new DummyEventLoop(); resolver = new PlatformDomainNameResolver(eventLoop); diff --git a/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp b/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp index 89cd7f1..71c6cf0 100644 --- a/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp +++ b/Swiften/Queries/Requests/UnitTest/GetPrivateStorageRequestTest.cpp @@ -16,8 +16,7 @@ using namespace Swift; -class GetPrivateStorageRequestTest : public CppUnit::TestFixture -{ +class GetPrivateStorageRequestTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(GetPrivateStorageRequestTest); CPPUNIT_TEST(testSend); CPPUNIT_TEST(testHandleResponse); @@ -32,8 +31,6 @@ class GetPrivateStorageRequestTest : public CppUnit::TestFixture }; public: - GetPrivateStorageRequestTest() {} - void setUp() { channel = new DummyIQChannel(); router = new IQRouter(channel); diff --git a/Swiften/Queries/UnitTest/IQRouterTest.cpp b/Swiften/Queries/UnitTest/IQRouterTest.cpp index 864108c..ef5da23 100644 --- a/Swiften/Queries/UnitTest/IQRouterTest.cpp +++ b/Swiften/Queries/UnitTest/IQRouterTest.cpp @@ -15,8 +15,7 @@ using namespace Swift; -class IQRouterTest : public CppUnit::TestFixture -{ +class IQRouterTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(IQRouterTest); CPPUNIT_TEST(testRemoveHandler); CPPUNIT_TEST(testRemoveHandler_AfterHandleIQ); @@ -30,8 +29,6 @@ class IQRouterTest : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: - IQRouterTest() {} - void setUp() { channel_ = new DummyIQChannel(); } diff --git a/Swiften/Queries/UnitTest/RequestTest.cpp b/Swiften/Queries/UnitTest/RequestTest.cpp index 3d8d6f2..5013053 100644 --- a/Swiften/Queries/UnitTest/RequestTest.cpp +++ b/Swiften/Queries/UnitTest/RequestTest.cpp @@ -16,8 +16,7 @@ using namespace Swift; -class RequestTest : public CppUnit::TestFixture -{ +class RequestTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(RequestTest); CPPUNIT_TEST(testSendGet); CPPUNIT_TEST(testSendSet); @@ -38,8 +37,6 @@ class RequestTest : public CppUnit::TestFixture typedef GenericRequest<MyPayload> MyRequest; public: - RequestTest() {} - void setUp() { channel_ = new DummyIQChannel(); router_ = new IQRouter(channel_); diff --git a/Swiften/Queries/UnitTest/ResponderTest.cpp b/Swiften/Queries/UnitTest/ResponderTest.cpp index 3a17729..97eb0c6 100644 --- a/Swiften/Queries/UnitTest/ResponderTest.cpp +++ b/Swiften/Queries/UnitTest/ResponderTest.cpp @@ -16,8 +16,7 @@ using namespace Swift; -class ResponderTest : public CppUnit::TestFixture -{ +class ResponderTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(ResponderTest); CPPUNIT_TEST(testConstructor); CPPUNIT_TEST(testStart); @@ -30,8 +29,6 @@ class ResponderTest : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: - ResponderTest() {} - void setUp() { channel_ = new DummyIQChannel(); router_ = new IQRouter(channel_); diff --git a/Swiften/Roster/UnitTest/XMPPRosterControllerTest.cpp b/Swiften/Roster/UnitTest/XMPPRosterControllerTest.cpp index a8585f1..debbd50 100644 --- a/Swiften/Roster/UnitTest/XMPPRosterControllerTest.cpp +++ b/Swiften/Roster/UnitTest/XMPPRosterControllerTest.cpp @@ -17,8 +17,7 @@ using namespace Swift; -class XMPPRosterControllerTest : public CppUnit::TestFixture -{ +class XMPPRosterControllerTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(XMPPRosterControllerTest); CPPUNIT_TEST(testAdd); CPPUNIT_TEST(testModify); @@ -26,8 +25,6 @@ class XMPPRosterControllerTest : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: - XMPPRosterControllerTest() {} - void setUp() { channel_ = new DummyIQChannel(); router_ = new IQRouter(channel_); diff --git a/Swiften/Roster/UnitTest/XMPPRosterImplTest.cpp b/Swiften/Roster/UnitTest/XMPPRosterImplTest.cpp index fbc3430..5f0c9fd 100644 --- a/Swiften/Roster/UnitTest/XMPPRosterImplTest.cpp +++ b/Swiften/Roster/UnitTest/XMPPRosterImplTest.cpp @@ -73,28 +73,18 @@ private: }; -class XMPPRosterImplTest : public CppUnit::TestFixture -{ +class XMPPRosterImplTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(XMPPRosterImplTest); CPPUNIT_TEST(testJIDAdded); CPPUNIT_TEST(testJIDRemoved); CPPUNIT_TEST(testJIDUpdated); CPPUNIT_TEST_SUITE_END(); - private: - XMPPRosterImpl* roster_; - XMPPRosterSignalHandler* handler_; - JID jid1_; - JID jid2_; - JID jid3_; - std::vector<String> groups1_; - std::vector<String> groups2_; - - public: - XMPPRosterImplTest() : jid1_(JID("a@b.c")), jid2_(JID("b@c.d")), jid3_(JID("c@d.e")) {} - void setUp() { + jid1_ = JID("a@b.c"); + jid2_ = JID("b@c.d"); + jid3_ = JID("c@d.e"); roster_ = new XMPPRosterImpl(); handler_ = new XMPPRosterSignalHandler(roster_); groups1_.push_back("bobs"); @@ -165,6 +155,14 @@ class XMPPRosterImplTest : public CppUnit::TestFixture CPPUNIT_ASSERT(groups2_ == roster_->getGroupsForJID(jid1_)); } + private: + XMPPRosterImpl* roster_; + XMPPRosterSignalHandler* handler_; + JID jid1_; + JID jid2_; + JID jid3_; + std::vector<String> groups1_; + std::vector<String> groups2_; }; CPPUNIT_TEST_SUITE_REGISTRATION(XMPPRosterImplTest); diff --git a/Swiften/StreamStack/UnitTest/StreamStackTest.cpp b/Swiften/StreamStack/UnitTest/StreamStackTest.cpp index 2405ddc..20b976d 100644 --- a/Swiften/StreamStack/UnitTest/StreamStackTest.cpp +++ b/Swiften/StreamStack/UnitTest/StreamStackTest.cpp @@ -22,8 +22,7 @@ using namespace Swift; -class StreamStackTest : public CppUnit::TestFixture -{ +class StreamStackTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(StreamStackTest); CPPUNIT_TEST(testWriteData_NoIntermediateStreamStack); CPPUNIT_TEST(testWriteData_OneIntermediateStream); @@ -35,8 +34,6 @@ class StreamStackTest : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: - StreamStackTest() {} - void setUp() { physicalStream_ = new TestLowLayer(); xmppStream_ = new XMPPLayer(&parserFactories_, &serializers_, ClientStreamType); |