diff options
Diffstat (limited to 'Swift/Controllers/Roster/UnitTest/TableRosterTest.cpp')
-rw-r--r-- | Swift/Controllers/Roster/UnitTest/TableRosterTest.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/Swift/Controllers/Roster/UnitTest/TableRosterTest.cpp b/Swift/Controllers/Roster/UnitTest/TableRosterTest.cpp index e4e8bdb..ddc8785 100644 --- a/Swift/Controllers/Roster/UnitTest/TableRosterTest.cpp +++ b/Swift/Controllers/Roster/UnitTest/TableRosterTest.cpp @@ -13,10 +13,11 @@ std::ostream& operator<<(std::ostream& os, const Swift::TableRoster::Index& i) { return os; } +#include <memory> + #include <cppunit/extensions/HelperMacros.h> #include <cppunit/extensions/TestFactoryRegistry.h> -#include <memory> #include <boost/variant.hpp> #include <Swiften/Network/DummyTimerFactory.h> @@ -33,17 +34,12 @@ class TableRosterTest : public CppUnit::TestFixture { public: void setUp() { - timerFactory = new DummyTimerFactory(); - roster = new Roster(); + timerFactory = std::unique_ptr<DummyTimerFactory>(new DummyTimerFactory()); + roster = std::unique_ptr<Roster>(new Roster()); jid1 = JID("jid1@example.com"); jid2 = JID("jid2@example.com"); } - void tearDown() { - delete roster; - delete timerFactory; - } - void testAddContact_EmptyRoster() { /* std::shared_ptr<TableRoster> tableRoster(createTestling()); @@ -73,7 +69,7 @@ class TableRosterTest : public CppUnit::TestFixture { } TableRoster* createTestling() { - TableRoster* result = new TableRoster(roster, timerFactory, 10); + TableRoster* result = new TableRoster(roster.get(), timerFactory.get(), 10); result->onUpdate.connect(boost::bind(&TableRosterTest::handleUpdate, this, _1)); return result; } @@ -83,8 +79,8 @@ class TableRosterTest : public CppUnit::TestFixture { } private: - DummyTimerFactory* timerFactory; - Roster* roster; + std::unique_ptr<DummyTimerFactory> timerFactory; + std::unique_ptr<Roster> roster; JID jid1; JID jid2; std::vector<TableRoster::Update> updates; |