summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-04-01 17:23:49 (GMT)
committerTobias Markmann <tm@ayena.de>2016-04-04 08:28:23 (GMT)
commit741c45b74d5f634622eb5f757c49323274fb8937 (patch)
treeb9cfa6c2fe2e79e03cc8cb7c1ca1e9cf45aa5328 /Slimber/UnitTest
parenteddd92ed76ae68cb1e202602fd3ebd11b69191a2 (diff)
downloadswift-741c45b74d5f634622eb5f757c49323274fb8937.zip
swift-741c45b74d5f634622eb5f757c49323274fb8937.tar.bz2
Modernize code to use C++11 shared_ptr instead of Boost's
This change was done by applying the following 'gsed' replacement calls to all source files: 's/\#include <boost\/shared_ptr\.hpp>/\#include <memory>/g' 's/\#include <boost\/enable_shared_from_this\.hpp>/\#include <memory>/g' 's/\#include <boost\/smart_ptr\/make_shared\.hpp>/\#include <memory>/g' 's/\#include <boost\/make_shared\.hpp>/\#include <memory>/g' 's/\#include <boost\/weak_ptr\.hpp>/\#include <memory>/g' 's/boost::make_shared/std::make_shared/g' 's/boost::dynamic_pointer_cast/std::dynamic_pointer_cast/g' 's/boost::shared_ptr/std::shared_ptr/g' 's/boost::weak_ptr/std::weak_ptr/g' 's/boost::enable_shared_from_this/std::enable_shared_from_this/g' The remaining issues have been fixed manually. Test-Information: Code builds on OS X 10.11.4 and unit tests pass. Change-Id: Ia7ae34eab869fb9ad6387a1348426b71ae4acd5f
Diffstat (limited to 'Slimber/UnitTest')
-rw-r--r--Slimber/UnitTest/LinkLocalPresenceManagerTest.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/Slimber/UnitTest/LinkLocalPresenceManagerTest.cpp b/Slimber/UnitTest/LinkLocalPresenceManagerTest.cpp
index 45bc2aa..c8e7700 100644
--- a/Slimber/UnitTest/LinkLocalPresenceManagerTest.cpp
+++ b/Slimber/UnitTest/LinkLocalPresenceManagerTest.cpp
@@ -45,7 +45,7 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture {
public:
void setUp() {
eventLoop = new DummyEventLoop();
- querier = boost::make_shared<FakeDNSSDQuerier>("wonderland.lit", eventLoop);
+ querier = std::make_shared<FakeDNSSDQuerier>("wonderland.lit", eventLoop);
browser = new LinkLocalServiceBrowser(querier);
browser->start();
}
@@ -59,14 +59,14 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture {
void testConstructor() {
addService("alice@wonderland");
addService("rabbit@teaparty");
- boost::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
+ std::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(testling->getRoster()->getItems().size()));
CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(testling->getAllPresence().size()));
}
void testServiceAdded() {
- boost::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
+ std::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
addService("alice@wonderland", "Alice");
@@ -82,7 +82,7 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture {
}
void testServiceRemoved() {
- boost::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
+ std::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
addService("alice@wonderland");
removeService("alice@wonderland");
@@ -95,7 +95,7 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture {
}
void testServiceChanged() {
- boost::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
+ std::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
addService("alice@wonderland");
updateServicePresence("alice@wonderland", LinkLocalServiceInfo::Away, "I'm Away");
@@ -108,13 +108,13 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture {
}
void testGetAllPresence() {
- boost::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
+ std::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
addService("alice@wonderland");
addService("rabbit@teaparty");
updateServicePresence("rabbit@teaparty", LinkLocalServiceInfo::Away, "Partying");
- std::vector<boost::shared_ptr<Presence> > presences = testling->getAllPresence();
+ std::vector<std::shared_ptr<Presence> > presences = testling->getAllPresence();
CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(presences.size()));
// The order doesn't matter
CPPUNIT_ASSERT(JID("rabbit@teaparty") == presences[0]->getFrom());
@@ -124,12 +124,12 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture {
}
void testGetRoster() {
- boost::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
+ std::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
addService("alice@wonderland", "Alice");
addService("rabbit@teaparty", "Rabbit");
- boost::shared_ptr<RosterPayload> roster = testling->getRoster();
+ std::shared_ptr<RosterPayload> roster = testling->getRoster();
CPPUNIT_ASSERT_EQUAL(2, static_cast<int>(roster->getItems().size()));
boost::optional<RosterItemPayload> item;
item = roster->getItem(JID("alice@wonderland"));
@@ -143,7 +143,7 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture {
}
void testGetRoster_InfoWithNick() {
- boost::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
+ std::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
addService("alice@wonderland", "Alice", "Alice In", "Wonderland");
@@ -152,7 +152,7 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture {
}
void testGetRoster_InfoWithFirstName() {
- boost::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
+ std::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
addService("alice@wonderland", "", "Alice In", "");
@@ -161,7 +161,7 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture {
}
void testGetRoster_InfoWithLastName() {
- boost::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
+ std::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
addService("alice@wonderland", "", "", "Wonderland");
@@ -170,7 +170,7 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture {
}
void testGetRoster_InfoWithFirstAndLastName() {
- boost::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
+ std::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
addService("alice@wonderland", "", "Alice In", "Wonderland");
@@ -179,7 +179,7 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture {
}
void testGetRoster_NoInfo() {
- boost::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
+ std::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
addService("alice@wonderland");
@@ -188,7 +188,7 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture {
}
void testGetServiceForJID() {
- boost::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
+ std::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
addService("alice@wonderland");
addService("rabbit@teaparty");
@@ -200,7 +200,7 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture {
}
void testGetServiceForJID_NoMatch() {
- boost::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
+ std::shared_ptr<LinkLocalPresenceManager> testling(createTestling());
addService("alice@wonderland");
addService("queen@garden");
@@ -209,8 +209,8 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture {
}
private:
- boost::shared_ptr<LinkLocalPresenceManager> createTestling() {
- boost::shared_ptr<LinkLocalPresenceManager> testling(
+ std::shared_ptr<LinkLocalPresenceManager> createTestling() {
+ std::shared_ptr<LinkLocalPresenceManager> testling(
new LinkLocalPresenceManager(browser));
testling->onRosterChanged.connect(boost::bind(
&LinkLocalPresenceManagerTest::handleRosterChanged, this, _1));
@@ -245,20 +245,20 @@ class LinkLocalPresenceManagerTest : public CppUnit::TestFixture {
eventLoop->processEvents();
}
- void handleRosterChanged(boost::shared_ptr<RosterPayload> payload) {
+ void handleRosterChanged(std::shared_ptr<RosterPayload> payload) {
rosterChanges.push_back(payload);
}
- void handlePresenceChanged(boost::shared_ptr<Presence> presence) {
+ void handlePresenceChanged(std::shared_ptr<Presence> presence) {
presenceChanges.push_back(presence);
}
private:
DummyEventLoop* eventLoop;
- boost::shared_ptr<FakeDNSSDQuerier> querier;
+ std::shared_ptr<FakeDNSSDQuerier> querier;
LinkLocalServiceBrowser* browser;
- std::vector< boost::shared_ptr<RosterPayload> > rosterChanges;
- std::vector< boost::shared_ptr<Presence> > presenceChanges;
+ std::vector< std::shared_ptr<RosterPayload> > rosterChanges;
+ std::vector< std::shared_ptr<Presence> > presenceChanges;
};
CPPUNIT_TEST_SUITE_REGISTRATION(LinkLocalPresenceManagerTest);