mirror of
https://github.com/aria2/aria2.git
synced 2025-04-05 13:37:40 +03:00
2008-03-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
type cleanup for allmost all remaining files.
This commit is contained in:
parent
ca3f6e57f3
commit
032c7c2808
278 changed files with 1489 additions and 1517 deletions
|
@ -62,11 +62,11 @@ public:
|
|||
class MockBtMessage2 : public MockBtMessage {
|
||||
public:
|
||||
std::string type;
|
||||
int32_t index;
|
||||
int32_t begin;
|
||||
int32_t length;
|
||||
size_t index;
|
||||
uint32_t begin;
|
||||
size_t length;
|
||||
public:
|
||||
MockBtMessage2(std::string type, int32_t index, int32_t begin, int32_t length):type(type), index(index), begin(begin), length(length) {}
|
||||
MockBtMessage2(std::string type, size_t index, uint32_t begin, size_t length):type(type), index(index), begin(begin), length(length) {}
|
||||
};
|
||||
|
||||
typedef SharedHandle<MockBtMessage2> MockBtMessage2Handle;
|
||||
|
@ -74,13 +74,13 @@ public:
|
|||
class MockBtMessageFactory2 : public MockBtMessageFactory {
|
||||
public:
|
||||
virtual SharedHandle<BtMessage>
|
||||
createPieceMessage(int32_t index, int32_t begin, int32_t length) {
|
||||
createPieceMessage(size_t index, uint32_t begin, size_t length) {
|
||||
SharedHandle<MockBtMessage2> btMsg = new MockBtMessage2("piece", index, begin, length);
|
||||
return btMsg;
|
||||
}
|
||||
|
||||
virtual SharedHandle<BtMessage>
|
||||
createRejectMessage(int32_t index, int32_t begin, int32_t length) {
|
||||
createRejectMessage(size_t index, uint32_t begin, size_t length) {
|
||||
SharedHandle<MockBtMessage2> btMsg = new MockBtMessage2("reject", index, begin, length);
|
||||
return btMsg;
|
||||
}
|
||||
|
@ -141,10 +141,10 @@ void BtRequestMessageTest::testCreate() {
|
|||
PeerMessageUtil::setIntParam(&msg[9], 256);
|
||||
PeerMessageUtil::setIntParam(&msg[13], 1024);
|
||||
SharedHandle<BtRequestMessage> pm = BtRequestMessage::create(&msg[4], 13);
|
||||
CPPUNIT_ASSERT_EQUAL((int8_t)6, pm->getId());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)12345, pm->getIndex());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)256, pm->getBegin());
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)1024, pm->getLength());
|
||||
CPPUNIT_ASSERT_EQUAL((uint8_t)6, pm->getId());
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)12345, pm->getIndex());
|
||||
CPPUNIT_ASSERT_EQUAL((uint32_t)256, pm->getBegin());
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)1024, pm->getLength());
|
||||
|
||||
// case: payload size is wrong
|
||||
try {
|
||||
|
@ -184,9 +184,9 @@ void BtRequestMessageTest::testDoReceivedAction_hasPieceAndAmNotChoking() {
|
|||
CPPUNIT_ASSERT_EQUAL((size_t)1, dispatcher->messageQueue.size());
|
||||
MockBtMessage2* pieceMsg = (MockBtMessage2*)dispatcher->messageQueue.front().get();
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("piece"), pieceMsg->type);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)1, pieceMsg->index);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)16, pieceMsg->begin);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)32, pieceMsg->length);
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)1, pieceMsg->index);
|
||||
CPPUNIT_ASSERT_EQUAL((uint32_t)16, pieceMsg->begin);
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)32, pieceMsg->length);
|
||||
}
|
||||
|
||||
void BtRequestMessageTest::testDoReceivedAction_hasPieceAndAmChokingAndFastExtensionEnabled() {
|
||||
|
@ -197,9 +197,9 @@ void BtRequestMessageTest::testDoReceivedAction_hasPieceAndAmChokingAndFastExten
|
|||
CPPUNIT_ASSERT_EQUAL((size_t)1, dispatcher->messageQueue.size());
|
||||
MockBtMessage2* pieceMsg = (MockBtMessage2*)dispatcher->messageQueue.front().get();
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("reject"), pieceMsg->type);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)1, pieceMsg->index);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)16, pieceMsg->begin);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)32, pieceMsg->length);
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)1, pieceMsg->index);
|
||||
CPPUNIT_ASSERT_EQUAL((uint32_t)16, pieceMsg->begin);
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)32, pieceMsg->length);
|
||||
}
|
||||
|
||||
void BtRequestMessageTest::testDoReceivedAction_hasPieceAndAmChokingAndFastExtensionDisabled() {
|
||||
|
@ -218,9 +218,9 @@ void BtRequestMessageTest::testDoReceivedAction_doesntHavePieceAndFastExtensionE
|
|||
CPPUNIT_ASSERT_EQUAL((size_t)1, dispatcher->messageQueue.size());
|
||||
MockBtMessage2* pieceMsg = (MockBtMessage2*)dispatcher->messageQueue.front().get();
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("reject"), pieceMsg->type);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)2, pieceMsg->index);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)16, pieceMsg->begin);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)32, pieceMsg->length);
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)2, pieceMsg->index);
|
||||
CPPUNIT_ASSERT_EQUAL((uint32_t)16, pieceMsg->begin);
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)32, pieceMsg->length);
|
||||
}
|
||||
|
||||
void BtRequestMessageTest::testDoReceivedAction_doesntHavePieceAndFastExtensionDisabled() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue