aria2/test/UTMetadataRejectExtensionMessageTest.cc
Tatsuhiro Tsujikawa 93968c4fa5 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
2009-11-20 15:42:25 +00:00

55 lines
1.4 KiB
C++

#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