mirror of
https://github.com/aria2/aria2.git
synced 2025-04-05 05:27:38 +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
55
test/UTMetadataRejectExtensionMessageTest.cc
Normal file
55
test/UTMetadataRejectExtensionMessageTest.cc
Normal file
|
@ -0,0 +1,55 @@
|
|||
#include "UTMetadataRejectExtensionMessage.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
#include "BtConstants.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class UTMetadataRejectExtensionMessageTest:public CppUnit::TestFixture {
|
||||
|
||||
CPPUNIT_TEST_SUITE(UTMetadataRejectExtensionMessageTest);
|
||||
CPPUNIT_TEST(testGetExtensionMessageID);
|
||||
CPPUNIT_TEST(testGetBencodedReject);
|
||||
CPPUNIT_TEST(testToString);
|
||||
CPPUNIT_TEST(testDoReceivedAction);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
public:
|
||||
void testGetExtensionMessageID();
|
||||
void testGetBencodedReject();
|
||||
void testToString();
|
||||
void testDoReceivedAction();
|
||||
};
|
||||
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(UTMetadataRejectExtensionMessageTest);
|
||||
|
||||
void UTMetadataRejectExtensionMessageTest::testGetExtensionMessageID()
|
||||
{
|
||||
UTMetadataRejectExtensionMessage msg(1);
|
||||
CPPUNIT_ASSERT_EQUAL((uint8_t)1, msg.getExtensionMessageID());
|
||||
}
|
||||
|
||||
void UTMetadataRejectExtensionMessageTest::testGetBencodedReject()
|
||||
{
|
||||
UTMetadataRejectExtensionMessage msg(1);
|
||||
msg.setIndex(1);
|
||||
CPPUNIT_ASSERT_EQUAL
|
||||
(std::string("d8:msg_typei2e5:piecei1ee"), msg.getBencodedData());
|
||||
}
|
||||
|
||||
void UTMetadataRejectExtensionMessageTest::testToString()
|
||||
{
|
||||
UTMetadataRejectExtensionMessage msg(1);
|
||||
msg.setIndex(100);
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("ut_metadata reject piece=100"),
|
||||
msg.toString());
|
||||
}
|
||||
|
||||
void UTMetadataRejectExtensionMessageTest::testDoReceivedAction()
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace aria2
|
Loading…
Add table
Add a link
Reference in a new issue