Wrap BtMessage objects by std::unique_ptr instead of std::shared_ptr

This commit is contained in:
Tatsuhiro Tsujikawa 2013-06-30 16:55:15 +09:00
parent abcb0745ed
commit 098f1571be
71 changed files with 816 additions and 852 deletions

View file

@ -32,9 +32,8 @@ void BtSuggestPieceMessageTest::testCreate() {
unsigned char msg[9];
bittorrent::createPeerMessageString(msg, sizeof(msg), 5, 13);
bittorrent::setIntParam(&msg[5], 12345);
std::shared_ptr<BtSuggestPieceMessage> pm
(BtSuggestPieceMessage::create(&msg[4], 5));
CPPUNIT_ASSERT_EQUAL((uint8_t)13, pm->getId());
auto pm = BtSuggestPieceMessage::create(&msg[4], 5);
CPPUNIT_ASSERT(BtSuggestPieceMessage::ID == pm->getId());
CPPUNIT_ASSERT_EQUAL((size_t)12345, pm->getIndex());
// case: payload size is wrong