mirror of
https://github.com/aria2/aria2.git
synced 2025-04-05 21:47:37 +03:00
2009-11-21 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Initial support of Extension for Peers to Send Metadata Files(BEP9). Currently aria2 only serves metadata and cannot get metadata from swarm. * src/BtConstants.h * src/DefaultBtInteractive.cc * src/DefaultExtensionMessageFactory.cc * src/DefaultExtensionMessageFactory.h * src/ExtensionMessage.h * src/ExtensionMessageRegistry.h * src/HandshakeExtensionMessage.cc * src/HandshakeExtensionMessage.h * src/Makefile.am * src/PeerConnection.h * src/PeerInteractionCommand.cc * src/UTMetadataDataExtensionMessage.cc * src/UTMetadataDataExtensionMessage.h * src/UTMetadataExtensionMessage.cc * src/UTMetadataExtensionMessage.h * src/UTMetadataRejectExtensionMessage.cc * src/UTMetadataRejectExtensionMessage.h * src/UTMetadataRequestExtensionMessage.cc * src/UTMetadataRequestExtensionMessage.h * src/bittorrent_helper.cc * src/bittorrent_helper.h * test/BittorrentHelperTest.cc * test/DefaultExtensionMessageFactoryTest.cc * test/HandshakeExtensionMessageTest.cc * test/Makefile.am * test/UTMetadataDataExtensionMessageTest.cc * test/UTMetadataRejectExtensionMessageTest.cc * test/UTMetadataRequestExtensionMessageTest.cc
This commit is contained in:
parent
2764b6739d
commit
93968c4fa5
31 changed files with 1262 additions and 32 deletions
60
test/UTMetadataDataExtensionMessageTest.cc
Normal file
60
test/UTMetadataDataExtensionMessageTest.cc
Normal file
|
@ -0,0 +1,60 @@
|
|||
#include "UTMetadataDataExtensionMessage.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
#include "BtConstants.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class UTMetadataDataExtensionMessageTest:public CppUnit::TestFixture {
|
||||
|
||||
CPPUNIT_TEST_SUITE(UTMetadataDataExtensionMessageTest);
|
||||
CPPUNIT_TEST(testGetExtensionMessageID);
|
||||
CPPUNIT_TEST(testGetBencodedData);
|
||||
CPPUNIT_TEST(testToString);
|
||||
CPPUNIT_TEST(testDoReceivedAction);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
public:
|
||||
void testGetExtensionMessageID();
|
||||
void testGetBencodedData();
|
||||
void testToString();
|
||||
void testDoReceivedAction();
|
||||
};
|
||||
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(UTMetadataDataExtensionMessageTest);
|
||||
|
||||
void UTMetadataDataExtensionMessageTest::testGetExtensionMessageID()
|
||||
{
|
||||
UTMetadataDataExtensionMessage msg(1);
|
||||
CPPUNIT_ASSERT_EQUAL((uint8_t)1, msg.getExtensionMessageID());
|
||||
}
|
||||
|
||||
void UTMetadataDataExtensionMessageTest::testGetBencodedData()
|
||||
{
|
||||
std::string data(METADATA_PIECE_SIZE, '0');
|
||||
|
||||
UTMetadataDataExtensionMessage msg(1);
|
||||
msg.setIndex(1);
|
||||
msg.setTotalSize(data.size());
|
||||
msg.setData(data);
|
||||
CPPUNIT_ASSERT_EQUAL
|
||||
(std::string("d8:msg_typei1e5:piecei1e10:total_sizei16384ee16384:")+data,
|
||||
msg.getBencodedData());
|
||||
}
|
||||
|
||||
void UTMetadataDataExtensionMessageTest::testToString()
|
||||
{
|
||||
UTMetadataDataExtensionMessage msg(1);
|
||||
msg.setIndex(100);
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("ut_metadata data piece=100"),
|
||||
msg.toString());
|
||||
}
|
||||
|
||||
void UTMetadataDataExtensionMessageTest::testDoReceivedAction()
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace aria2
|
Loading…
Add table
Add a link
Reference in a new issue