diff options
author | Tobias Markmann <tm@ayena.de> | 2016-09-29 15:22:52 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2016-09-29 15:22:52 (GMT) |
commit | 9abfaaa771f91010dbe01a1b9b5b9e2801956718 (patch) | |
tree | 618a5f66ea97d3d8552f72aad6a8e1313c56ec6e /Swiften/Roster/UnitTest | |
parent | 2bf44a1d641c3bc35546cb49d3766f2962f9a984 (diff) | |
download | swift-9abfaaa771f91010dbe01a1b9b5b9e2801956718.zip swift-9abfaaa771f91010dbe01a1b9b5b9e2801956718.tar.bz2 |
Fix uninitialised class members
Initialised previously uninitialised class members. Changed
some raw pointers to std::unique_ptr for clearer and
automatically initialised code.
Test-Information:
Builds on macOS 10.12 and unit tests pass in ASAN-enabled
build.
Change-Id: I7900fe6131119c228ca92c79c0ee8125137f2e48
Diffstat (limited to 'Swiften/Roster/UnitTest')
-rw-r--r-- | Swiften/Roster/UnitTest/XMPPRosterImplTest.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/Swiften/Roster/UnitTest/XMPPRosterImplTest.cpp b/Swiften/Roster/UnitTest/XMPPRosterImplTest.cpp index f0d92e9..73e76d3 100644 --- a/Swiften/Roster/UnitTest/XMPPRosterImplTest.cpp +++ b/Swiften/Roster/UnitTest/XMPPRosterImplTest.cpp @@ -30,18 +30,13 @@ class XMPPRosterImplTest : public CppUnit::TestFixture { jid1_ = JID("a@b.c"); jid2_ = JID("b@c.d"); jid3_ = JID("c@d.e"); - roster_ = new XMPPRosterImpl(); - handler_ = new XMPPRosterSignalHandler(roster_); + roster_ = std::unique_ptr<XMPPRosterImpl>(new XMPPRosterImpl()); + handler_ = std::unique_ptr<XMPPRosterSignalHandler>(new XMPPRosterSignalHandler(roster_.get())); groups1_.push_back("bobs"); groups1_.push_back("berts"); groups2_.push_back("ernies"); } - void tearDown() { - delete handler_; - delete roster_; - } - void testJIDAdded() { roster_->addContact(jid1_, "NewName", groups1_, RosterItemPayload::Both); CPPUNIT_ASSERT_EQUAL(Add, handler_->getLastEvent()); @@ -101,8 +96,8 @@ class XMPPRosterImplTest : public CppUnit::TestFixture { } private: - XMPPRosterImpl* roster_; - XMPPRosterSignalHandler* handler_; + std::unique_ptr<XMPPRosterImpl> roster_; + std::unique_ptr<XMPPRosterSignalHandler> handler_; JID jid1_; JID jid2_; JID jid3_; |