mirror of
https://github.com/aria2/aria2.git
synced 2025-04-05 21:47:37 +03:00
Merged Ross's patch to test code.
This commit is contained in:
parent
8d84d9f97c
commit
19ef788023
30 changed files with 173 additions and 107 deletions
|
@ -48,12 +48,12 @@ CPPUNIT_TEST_SUITE_REGISTRATION( BitfieldManTest );
|
||||||
|
|
||||||
void BitfieldManTest::testGetBlockSize() {
|
void BitfieldManTest::testGetBlockSize() {
|
||||||
BitfieldMan bt1(1024, 1024*10);
|
BitfieldMan bt1(1024, 1024*10);
|
||||||
CPPUNIT_ASSERT_EQUAL(1024, bt1.getBlockLength(9));
|
CPPUNIT_ASSERT_EQUAL((int32_t)1024, bt1.getBlockLength(9));
|
||||||
|
|
||||||
BitfieldMan bt2(1024, 1024*10+1);
|
BitfieldMan bt2(1024, 1024*10+1);
|
||||||
CPPUNIT_ASSERT_EQUAL(1024, bt2.getBlockLength(9));
|
CPPUNIT_ASSERT_EQUAL((int32_t)1024, bt2.getBlockLength(9));
|
||||||
CPPUNIT_ASSERT_EQUAL(1, bt2.getBlockLength(10));
|
CPPUNIT_ASSERT_EQUAL((int32_t)1, bt2.getBlockLength(10));
|
||||||
CPPUNIT_ASSERT_EQUAL(0, bt2.getBlockLength(11));
|
CPPUNIT_ASSERT_EQUAL((int32_t)0, bt2.getBlockLength(11));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitfieldManTest::testGetFirstMissingUnusedIndex() {
|
void BitfieldManTest::testGetFirstMissingUnusedIndex() {
|
||||||
|
@ -61,22 +61,22 @@ void BitfieldManTest::testGetFirstMissingUnusedIndex() {
|
||||||
unsigned char bitfield[2];
|
unsigned char bitfield[2];
|
||||||
memset(bitfield, 0xff, sizeof(bitfield));
|
memset(bitfield, 0xff, sizeof(bitfield));
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(0, bt1.getFirstMissingUnusedIndex(bitfield, sizeof(bitfield)));
|
CPPUNIT_ASSERT_EQUAL((int32_t)0, bt1.getFirstMissingUnusedIndex(bitfield, sizeof(bitfield)));
|
||||||
CPPUNIT_ASSERT(bt1.setUseBit(0));
|
CPPUNIT_ASSERT(bt1.setUseBit(0));
|
||||||
CPPUNIT_ASSERT_EQUAL(1, bt1.getFirstMissingUnusedIndex(bitfield, sizeof(bitfield)));
|
CPPUNIT_ASSERT_EQUAL((int32_t)1, bt1.getFirstMissingUnusedIndex(bitfield, sizeof(bitfield)));
|
||||||
CPPUNIT_ASSERT(bt1.unsetUseBit(0));
|
CPPUNIT_ASSERT(bt1.unsetUseBit(0));
|
||||||
CPPUNIT_ASSERT_EQUAL(0, bt1.getFirstMissingUnusedIndex(bitfield, sizeof(bitfield)));
|
CPPUNIT_ASSERT_EQUAL((int32_t)0, bt1.getFirstMissingUnusedIndex(bitfield, sizeof(bitfield)));
|
||||||
CPPUNIT_ASSERT(bt1.setBit(0));
|
CPPUNIT_ASSERT(bt1.setBit(0));
|
||||||
CPPUNIT_ASSERT_EQUAL(1, bt1.getFirstMissingUnusedIndex(bitfield, sizeof(bitfield)));
|
CPPUNIT_ASSERT_EQUAL((int32_t)1, bt1.getFirstMissingUnusedIndex(bitfield, sizeof(bitfield)));
|
||||||
|
|
||||||
for(int i = 0; i < 8; i++) {
|
for(int i = 0; i < 8; i++) {
|
||||||
CPPUNIT_ASSERT(bt1.setBit(i));
|
CPPUNIT_ASSERT(bt1.setBit(i));
|
||||||
}
|
}
|
||||||
CPPUNIT_ASSERT_EQUAL(8, bt1.getFirstMissingUnusedIndex(bitfield, sizeof(bitfield)));
|
CPPUNIT_ASSERT_EQUAL((int32_t)8, bt1.getFirstMissingUnusedIndex(bitfield, sizeof(bitfield)));
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(8, bt1.getFirstMissingUnusedIndex());
|
CPPUNIT_ASSERT_EQUAL((int32_t)8, bt1.getFirstMissingUnusedIndex());
|
||||||
CPPUNIT_ASSERT(bt1.setUseBit(8));
|
CPPUNIT_ASSERT(bt1.setUseBit(8));
|
||||||
CPPUNIT_ASSERT_EQUAL(9, bt1.getFirstMissingUnusedIndex());
|
CPPUNIT_ASSERT_EQUAL((int32_t)9, bt1.getFirstMissingUnusedIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitfieldManTest::testIsAllBitSet() {
|
void BitfieldManTest::testIsAllBitSet() {
|
||||||
|
@ -174,7 +174,7 @@ void BitfieldManTest::testGetMissingIndex() {
|
||||||
0xff, 0xff, 0xff, 0xff,
|
0xff, 0xff, 0xff, 0xff,
|
||||||
0xff, 0xff, 0xff, 0xff,
|
0xff, 0xff, 0xff, 0xff,
|
||||||
};
|
};
|
||||||
CPPUNIT_ASSERT_EQUAL(0, bt1.getMissingIndex(bitArray, 32));
|
CPPUNIT_ASSERT_EQUAL((int32_t)0, bt1.getMissingIndex(bitArray, 32));
|
||||||
|
|
||||||
unsigned char bitArray2[] = {
|
unsigned char bitArray2[] = {
|
||||||
0x0f, 0xff, 0xff, 0xff,
|
0x0f, 0xff, 0xff, 0xff,
|
||||||
|
@ -187,7 +187,7 @@ void BitfieldManTest::testGetMissingIndex() {
|
||||||
0xff, 0xff, 0xff, 0xff,
|
0xff, 0xff, 0xff, 0xff,
|
||||||
};
|
};
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(4, bt1.getMissingIndex(bitArray2, 32));
|
CPPUNIT_ASSERT_EQUAL((int32_t)4, bt1.getMissingIndex(bitArray2, 32));
|
||||||
|
|
||||||
unsigned char bitArray3[] = {
|
unsigned char bitArray3[] = {
|
||||||
0x00, 0xff, 0xff, 0xff,
|
0x00, 0xff, 0xff, 0xff,
|
||||||
|
@ -200,7 +200,7 @@ void BitfieldManTest::testGetMissingIndex() {
|
||||||
0xff, 0xff, 0xff, 0xff,
|
0xff, 0xff, 0xff, 0xff,
|
||||||
};
|
};
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(8, bt1.getMissingIndex(bitArray3, 32));
|
CPPUNIT_ASSERT_EQUAL((int32_t)8, bt1.getMissingIndex(bitArray3, 32));
|
||||||
|
|
||||||
unsigned char bitArray4[] = {
|
unsigned char bitArray4[] = {
|
||||||
0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00,
|
||||||
|
@ -213,34 +213,34 @@ void BitfieldManTest::testGetMissingIndex() {
|
||||||
0x00, 0x00, 0x00, 0x00,
|
0x00, 0x00, 0x00, 0x00,
|
||||||
};
|
};
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(-1, bt1.getMissingIndex(bitArray4, 32));
|
CPPUNIT_ASSERT_EQUAL((int32_t)-1, bt1.getMissingIndex(bitArray4, 32));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitfieldManTest::testGetSparceMissingUnusedIndex() {
|
void BitfieldManTest::testGetSparceMissingUnusedIndex() {
|
||||||
BitfieldMan bitfield(1024*1024, 10*1024*1024);
|
BitfieldMan bitfield(1024*1024, 10*1024*1024);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(0, bitfield.getSparseMissingUnusedIndex());
|
CPPUNIT_ASSERT_EQUAL((int32_t)0, bitfield.getSparseMissingUnusedIndex());
|
||||||
bitfield.setBit(0);
|
bitfield.setBit(0);
|
||||||
CPPUNIT_ASSERT_EQUAL(5, bitfield.getSparseMissingUnusedIndex());
|
CPPUNIT_ASSERT_EQUAL((int32_t)5, bitfield.getSparseMissingUnusedIndex());
|
||||||
bitfield.setUseBit(5);
|
bitfield.setUseBit(5);
|
||||||
CPPUNIT_ASSERT_EQUAL(3, bitfield.getSparseMissingUnusedIndex());
|
CPPUNIT_ASSERT_EQUAL((int32_t)3, bitfield.getSparseMissingUnusedIndex());
|
||||||
bitfield.setBit(3);
|
bitfield.setBit(3);
|
||||||
CPPUNIT_ASSERT_EQUAL(8, bitfield.getSparseMissingUnusedIndex());
|
CPPUNIT_ASSERT_EQUAL((int32_t)8, bitfield.getSparseMissingUnusedIndex());
|
||||||
bitfield.setBit(8);
|
bitfield.setBit(8);
|
||||||
CPPUNIT_ASSERT_EQUAL(2, bitfield.getSparseMissingUnusedIndex());
|
CPPUNIT_ASSERT_EQUAL((int32_t)2, bitfield.getSparseMissingUnusedIndex());
|
||||||
bitfield.setBit(2);
|
bitfield.setBit(2);
|
||||||
CPPUNIT_ASSERT_EQUAL(7, bitfield.getSparseMissingUnusedIndex());
|
CPPUNIT_ASSERT_EQUAL((int32_t)7, bitfield.getSparseMissingUnusedIndex());
|
||||||
bitfield.setBit(7);
|
bitfield.setBit(7);
|
||||||
CPPUNIT_ASSERT_EQUAL(1, bitfield.getSparseMissingUnusedIndex());
|
CPPUNIT_ASSERT_EQUAL((int32_t)1, bitfield.getSparseMissingUnusedIndex());
|
||||||
bitfield.setBit(1);
|
bitfield.setBit(1);
|
||||||
CPPUNIT_ASSERT_EQUAL(4, bitfield.getSparseMissingUnusedIndex());
|
CPPUNIT_ASSERT_EQUAL((int32_t)4, bitfield.getSparseMissingUnusedIndex());
|
||||||
bitfield.setBit(4);
|
bitfield.setBit(4);
|
||||||
CPPUNIT_ASSERT_EQUAL(6, bitfield.getSparseMissingUnusedIndex());
|
CPPUNIT_ASSERT_EQUAL((int32_t)6, bitfield.getSparseMissingUnusedIndex());
|
||||||
bitfield.setBit(6);
|
bitfield.setBit(6);
|
||||||
CPPUNIT_ASSERT_EQUAL(9, bitfield.getSparseMissingUnusedIndex());
|
CPPUNIT_ASSERT_EQUAL((int32_t)9, bitfield.getSparseMissingUnusedIndex());
|
||||||
bitfield.setBit(9);
|
bitfield.setBit(9);
|
||||||
CPPUNIT_ASSERT_EQUAL(-1, bitfield.getSparseMissingUnusedIndex());
|
CPPUNIT_ASSERT_EQUAL((int32_t)-1, bitfield.getSparseMissingUnusedIndex());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitfieldManTest::testIsBitSetOffsetRange()
|
void BitfieldManTest::testIsBitSetOffsetRange()
|
||||||
|
|
|
@ -36,7 +36,7 @@ void BtAllowedFastMessageTest::testCreate() {
|
||||||
PeerMessageUtil::setIntParam(&msg[5], 12345);
|
PeerMessageUtil::setIntParam(&msg[5], 12345);
|
||||||
BtAllowedFastMessageHandle pm = BtAllowedFastMessage::create(&msg[4], 5);
|
BtAllowedFastMessageHandle pm = BtAllowedFastMessage::create(&msg[4], 5);
|
||||||
CPPUNIT_ASSERT_EQUAL((int8_t)17, pm->getId());
|
CPPUNIT_ASSERT_EQUAL((int8_t)17, pm->getId());
|
||||||
CPPUNIT_ASSERT_EQUAL(12345, pm->getIndex());
|
CPPUNIT_ASSERT_EQUAL((int32_t)12345, pm->getIndex());
|
||||||
|
|
||||||
// case: payload size is wrong
|
// case: payload size is wrong
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -37,7 +37,7 @@ void BtBitfieldMessageTest::testCreate() {
|
||||||
BtBitfieldMessageHandle pm = BtBitfieldMessage::create(&msg[4], 3);
|
BtBitfieldMessageHandle pm = BtBitfieldMessage::create(&msg[4], 3);
|
||||||
CPPUNIT_ASSERT_EQUAL((int8_t)5, pm->getId());
|
CPPUNIT_ASSERT_EQUAL((int8_t)5, pm->getId());
|
||||||
CPPUNIT_ASSERT(memcmp(bitfield, pm->getBitfield(), sizeof(bitfield)) == 0);
|
CPPUNIT_ASSERT(memcmp(bitfield, pm->getBitfield(), sizeof(bitfield)) == 0);
|
||||||
CPPUNIT_ASSERT_EQUAL(2, pm->getBitfieldLength());
|
CPPUNIT_ASSERT_EQUAL((int32_t)2, pm->getBitfieldLength());
|
||||||
// case: payload size is wrong
|
// case: payload size is wrong
|
||||||
try {
|
try {
|
||||||
unsigned char msg[5];
|
unsigned char msg[5];
|
||||||
|
|
|
@ -66,9 +66,9 @@ void BtCancelMessageTest::testCreate() {
|
||||||
PeerMessageUtil::setIntParam(&msg[13], 1024);
|
PeerMessageUtil::setIntParam(&msg[13], 1024);
|
||||||
BtCancelMessageHandle pm = BtCancelMessage::create(&msg[4], 13);
|
BtCancelMessageHandle pm = BtCancelMessage::create(&msg[4], 13);
|
||||||
CPPUNIT_ASSERT_EQUAL((int8_t)8, pm->getId());
|
CPPUNIT_ASSERT_EQUAL((int8_t)8, pm->getId());
|
||||||
CPPUNIT_ASSERT_EQUAL(12345, pm->getIndex());
|
CPPUNIT_ASSERT_EQUAL((int32_t)12345, pm->getIndex());
|
||||||
CPPUNIT_ASSERT_EQUAL(256, pm->getBegin());
|
CPPUNIT_ASSERT_EQUAL((int32_t)256, pm->getBegin());
|
||||||
CPPUNIT_ASSERT_EQUAL(1024, pm->getLength());
|
CPPUNIT_ASSERT_EQUAL((int32_t)1024, pm->getLength());
|
||||||
|
|
||||||
// case: payload size is wrong
|
// case: payload size is wrong
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -33,7 +33,7 @@ void BtHaveMessageTest::testCreate() {
|
||||||
PeerMessageUtil::setIntParam(&msg[5], 12345);
|
PeerMessageUtil::setIntParam(&msg[5], 12345);
|
||||||
BtHaveMessageHandle pm = BtHaveMessage::create(&msg[4], 5);
|
BtHaveMessageHandle pm = BtHaveMessage::create(&msg[4], 5);
|
||||||
CPPUNIT_ASSERT_EQUAL((int8_t)4, pm->getId());
|
CPPUNIT_ASSERT_EQUAL((int8_t)4, pm->getId());
|
||||||
CPPUNIT_ASSERT_EQUAL(12345, pm->getIndex());
|
CPPUNIT_ASSERT_EQUAL((int32_t)12345, pm->getIndex());
|
||||||
|
|
||||||
// case: payload size is wrong
|
// case: payload size is wrong
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -26,7 +26,7 @@ void BtKeepAliveMessageTest::testGetMessage() {
|
||||||
memset(msg, 0, sizeof(msg));
|
memset(msg, 0, sizeof(msg));
|
||||||
BtKeepAliveMessage message;
|
BtKeepAliveMessage message;
|
||||||
CPPUNIT_ASSERT_EQUAL((int8_t)99, message.getId());
|
CPPUNIT_ASSERT_EQUAL((int8_t)99, message.getId());
|
||||||
CPPUNIT_ASSERT_EQUAL(4, message.getMessageLength());
|
CPPUNIT_ASSERT_EQUAL((int32_t)4, message.getMessageLength());
|
||||||
CPPUNIT_ASSERT(memcmp(msg, message.getMessage(), 4) == 0);
|
CPPUNIT_ASSERT(memcmp(msg, message.getMessage(), 4) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,10 +112,10 @@ void BtPieceMessageTest::testCreate() {
|
||||||
memcpy(&msg[13], data, sizeof(data));
|
memcpy(&msg[13], data, sizeof(data));
|
||||||
BtPieceMessageHandle pm = BtPieceMessage::create(&msg[4], 11);
|
BtPieceMessageHandle pm = BtPieceMessage::create(&msg[4], 11);
|
||||||
CPPUNIT_ASSERT_EQUAL((int8_t)7, pm->getId());
|
CPPUNIT_ASSERT_EQUAL((int8_t)7, pm->getId());
|
||||||
CPPUNIT_ASSERT_EQUAL(12345, pm->getIndex());
|
CPPUNIT_ASSERT_EQUAL((int32_t)12345, pm->getIndex());
|
||||||
CPPUNIT_ASSERT_EQUAL(256, pm->getBegin());
|
CPPUNIT_ASSERT_EQUAL((int32_t)256, pm->getBegin());
|
||||||
CPPUNIT_ASSERT(memcmp(data, pm->getBlock(), sizeof(data)) == 0);
|
CPPUNIT_ASSERT(memcmp(data, pm->getBlock(), sizeof(data)) == 0);
|
||||||
CPPUNIT_ASSERT_EQUAL(2, pm->getBlockLength());
|
CPPUNIT_ASSERT_EQUAL((int32_t)2, pm->getBlockLength());
|
||||||
|
|
||||||
// case: payload size is wrong
|
// case: payload size is wrong
|
||||||
try {
|
try {
|
||||||
|
@ -172,9 +172,9 @@ void BtPieceMessageTest::testChokingEvent_allowedFastEnabled() {
|
||||||
CPPUNIT_ASSERT(msg->isInvalidate());
|
CPPUNIT_ASSERT(msg->isInvalidate());
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)1, btMessageDispatcher->messageQueue.size());
|
CPPUNIT_ASSERT_EQUAL((size_t)1, btMessageDispatcher->messageQueue.size());
|
||||||
MockBtMessage2* rej = (MockBtMessage2*)btMessageDispatcher->messageQueue.front().get();
|
MockBtMessage2* rej = (MockBtMessage2*)btMessageDispatcher->messageQueue.front().get();
|
||||||
CPPUNIT_ASSERT_EQUAL(1, rej->index);
|
CPPUNIT_ASSERT_EQUAL((int32_t)1, rej->index);
|
||||||
CPPUNIT_ASSERT_EQUAL(1024, rej->begin);
|
CPPUNIT_ASSERT_EQUAL((int32_t)1024, rej->begin);
|
||||||
CPPUNIT_ASSERT_EQUAL(16*1024, rej->length);
|
CPPUNIT_ASSERT_EQUAL((int32_t)16*1024, rej->length);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BtPieceMessageTest::testChokingEvent_inAmAllowedIndexSet() {
|
void BtPieceMessageTest::testChokingEvent_inAmAllowedIndexSet() {
|
||||||
|
@ -257,9 +257,9 @@ void BtPieceMessageTest::testCancelSendingPieceEvent_allowedFastEnabled() {
|
||||||
CPPUNIT_ASSERT(msg->isInvalidate());
|
CPPUNIT_ASSERT(msg->isInvalidate());
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)1, btMessageDispatcher->messageQueue.size());
|
CPPUNIT_ASSERT_EQUAL((size_t)1, btMessageDispatcher->messageQueue.size());
|
||||||
MockBtMessage2* rej = (MockBtMessage2*)btMessageDispatcher->messageQueue.front().get();
|
MockBtMessage2* rej = (MockBtMessage2*)btMessageDispatcher->messageQueue.front().get();
|
||||||
CPPUNIT_ASSERT_EQUAL(1, rej->index);
|
CPPUNIT_ASSERT_EQUAL((int32_t)1, rej->index);
|
||||||
CPPUNIT_ASSERT_EQUAL(1024, rej->begin);
|
CPPUNIT_ASSERT_EQUAL((int32_t)1024, rej->begin);
|
||||||
CPPUNIT_ASSERT_EQUAL(16*1024, rej->length);
|
CPPUNIT_ASSERT_EQUAL((int32_t)16*1024, rej->length);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BtPieceMessageTest::testCancelSendingPieceEvent_invalidate() {
|
void BtPieceMessageTest::testCancelSendingPieceEvent_invalidate() {
|
||||||
|
|
|
@ -98,9 +98,9 @@ void BtRejectMessageTest::testCreate() {
|
||||||
PeerMessageUtil::setIntParam(&msg[13], 1024);
|
PeerMessageUtil::setIntParam(&msg[13], 1024);
|
||||||
BtRejectMessageHandle pm = BtRejectMessage::create(&msg[4], 13);
|
BtRejectMessageHandle pm = BtRejectMessage::create(&msg[4], 13);
|
||||||
CPPUNIT_ASSERT_EQUAL((int8_t)16, pm->getId());
|
CPPUNIT_ASSERT_EQUAL((int8_t)16, pm->getId());
|
||||||
CPPUNIT_ASSERT_EQUAL(12345, pm->getIndex());
|
CPPUNIT_ASSERT_EQUAL((int32_t)12345, pm->getIndex());
|
||||||
CPPUNIT_ASSERT_EQUAL(256, pm->getBegin());
|
CPPUNIT_ASSERT_EQUAL((int32_t)256, pm->getBegin());
|
||||||
CPPUNIT_ASSERT_EQUAL(1024, pm->getLength());
|
CPPUNIT_ASSERT_EQUAL((int32_t)1024, pm->getLength());
|
||||||
|
|
||||||
// case: payload size is wrong
|
// case: payload size is wrong
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -132,9 +132,9 @@ void BtRequestMessageTest::testCreate() {
|
||||||
PeerMessageUtil::setIntParam(&msg[13], 1024);
|
PeerMessageUtil::setIntParam(&msg[13], 1024);
|
||||||
BtRequestMessageHandle pm = BtRequestMessage::create(&msg[4], 13);
|
BtRequestMessageHandle pm = BtRequestMessage::create(&msg[4], 13);
|
||||||
CPPUNIT_ASSERT_EQUAL((int8_t)6, pm->getId());
|
CPPUNIT_ASSERT_EQUAL((int8_t)6, pm->getId());
|
||||||
CPPUNIT_ASSERT_EQUAL(12345, pm->getIndex());
|
CPPUNIT_ASSERT_EQUAL((int32_t)12345, pm->getIndex());
|
||||||
CPPUNIT_ASSERT_EQUAL(256, pm->getBegin());
|
CPPUNIT_ASSERT_EQUAL((int32_t)256, pm->getBegin());
|
||||||
CPPUNIT_ASSERT_EQUAL(1024, pm->getLength());
|
CPPUNIT_ASSERT_EQUAL((int32_t)1024, pm->getLength());
|
||||||
|
|
||||||
// case: payload size is wrong
|
// case: payload size is wrong
|
||||||
try {
|
try {
|
||||||
|
@ -174,9 +174,9 @@ void BtRequestMessageTest::testDoReceivedAction_hasPieceAndAmNotChoking() {
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)1, dispatcher->messageQueue.size());
|
CPPUNIT_ASSERT_EQUAL((size_t)1, dispatcher->messageQueue.size());
|
||||||
MockBtMessage2* pieceMsg = (MockBtMessage2*)dispatcher->messageQueue.front().get();
|
MockBtMessage2* pieceMsg = (MockBtMessage2*)dispatcher->messageQueue.front().get();
|
||||||
CPPUNIT_ASSERT_EQUAL(string("piece"), pieceMsg->type);
|
CPPUNIT_ASSERT_EQUAL(string("piece"), pieceMsg->type);
|
||||||
CPPUNIT_ASSERT_EQUAL(1, pieceMsg->index);
|
CPPUNIT_ASSERT_EQUAL((int32_t)1, pieceMsg->index);
|
||||||
CPPUNIT_ASSERT_EQUAL(16, pieceMsg->begin);
|
CPPUNIT_ASSERT_EQUAL((int32_t)16, pieceMsg->begin);
|
||||||
CPPUNIT_ASSERT_EQUAL(32, pieceMsg->length);
|
CPPUNIT_ASSERT_EQUAL((int32_t)32, pieceMsg->length);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BtRequestMessageTest::testDoReceivedAction_hasPieceAndAmChokingAndFastExtensionEnabled() {
|
void BtRequestMessageTest::testDoReceivedAction_hasPieceAndAmChokingAndFastExtensionEnabled() {
|
||||||
|
@ -187,9 +187,9 @@ void BtRequestMessageTest::testDoReceivedAction_hasPieceAndAmChokingAndFastExten
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)1, dispatcher->messageQueue.size());
|
CPPUNIT_ASSERT_EQUAL((size_t)1, dispatcher->messageQueue.size());
|
||||||
MockBtMessage2* pieceMsg = (MockBtMessage2*)dispatcher->messageQueue.front().get();
|
MockBtMessage2* pieceMsg = (MockBtMessage2*)dispatcher->messageQueue.front().get();
|
||||||
CPPUNIT_ASSERT_EQUAL(string("reject"), pieceMsg->type);
|
CPPUNIT_ASSERT_EQUAL(string("reject"), pieceMsg->type);
|
||||||
CPPUNIT_ASSERT_EQUAL(1, pieceMsg->index);
|
CPPUNIT_ASSERT_EQUAL((int32_t)1, pieceMsg->index);
|
||||||
CPPUNIT_ASSERT_EQUAL(16, pieceMsg->begin);
|
CPPUNIT_ASSERT_EQUAL((int32_t)16, pieceMsg->begin);
|
||||||
CPPUNIT_ASSERT_EQUAL(32, pieceMsg->length);
|
CPPUNIT_ASSERT_EQUAL((int32_t)32, pieceMsg->length);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BtRequestMessageTest::testDoReceivedAction_hasPieceAndAmChokingAndFastExtensionDisabled() {
|
void BtRequestMessageTest::testDoReceivedAction_hasPieceAndAmChokingAndFastExtensionDisabled() {
|
||||||
|
@ -208,9 +208,9 @@ void BtRequestMessageTest::testDoReceivedAction_doesntHavePieceAndFastExtensionE
|
||||||
CPPUNIT_ASSERT_EQUAL((size_t)1, dispatcher->messageQueue.size());
|
CPPUNIT_ASSERT_EQUAL((size_t)1, dispatcher->messageQueue.size());
|
||||||
MockBtMessage2* pieceMsg = (MockBtMessage2*)dispatcher->messageQueue.front().get();
|
MockBtMessage2* pieceMsg = (MockBtMessage2*)dispatcher->messageQueue.front().get();
|
||||||
CPPUNIT_ASSERT_EQUAL(string("reject"), pieceMsg->type);
|
CPPUNIT_ASSERT_EQUAL(string("reject"), pieceMsg->type);
|
||||||
CPPUNIT_ASSERT_EQUAL(2, pieceMsg->index);
|
CPPUNIT_ASSERT_EQUAL((int32_t)2, pieceMsg->index);
|
||||||
CPPUNIT_ASSERT_EQUAL(16, pieceMsg->begin);
|
CPPUNIT_ASSERT_EQUAL((int32_t)16, pieceMsg->begin);
|
||||||
CPPUNIT_ASSERT_EQUAL(32, pieceMsg->length);
|
CPPUNIT_ASSERT_EQUAL((int32_t)32, pieceMsg->length);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BtRequestMessageTest::testDoReceivedAction_doesntHavePieceAndFastExtensionDisabled() {
|
void BtRequestMessageTest::testDoReceivedAction_doesntHavePieceAndFastExtensionDisabled() {
|
||||||
|
|
|
@ -31,7 +31,7 @@ void BtSuggestPieceMessageTest::testCreate() {
|
||||||
PeerMessageUtil::setIntParam(&msg[5], 12345);
|
PeerMessageUtil::setIntParam(&msg[5], 12345);
|
||||||
BtSuggestPieceMessageHandle pm = BtSuggestPieceMessage::create(&msg[4], 5);
|
BtSuggestPieceMessageHandle pm = BtSuggestPieceMessage::create(&msg[4], 5);
|
||||||
CPPUNIT_ASSERT_EQUAL((int8_t)13, pm->getId());
|
CPPUNIT_ASSERT_EQUAL((int8_t)13, pm->getId());
|
||||||
CPPUNIT_ASSERT_EQUAL(12345, pm->getIndex());
|
CPPUNIT_ASSERT_EQUAL((int32_t)12345, pm->getIndex());
|
||||||
|
|
||||||
// case: payload size is wrong
|
// case: payload size is wrong
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -35,6 +35,7 @@ const char* ChunkChecksumValidatorTest::csArray[] = { "29b0e7878271645fffb7eec7d
|
||||||
"0a4ea2f7dd7c52ddf2099a444ab2184b4d341bdb" };
|
"0a4ea2f7dd7c52ddf2099a444ab2184b4d341bdb" };
|
||||||
|
|
||||||
void ChunkChecksumValidatorTest::testValidate() {
|
void ChunkChecksumValidatorTest::testValidate() {
|
||||||
|
#ifdef ENABLE_MESSAGE_DIGEST
|
||||||
BitfieldMan bitfieldMan(100, 250);
|
BitfieldMan bitfieldMan(100, 250);
|
||||||
bitfieldMan.setAllBit();
|
bitfieldMan.setAllBit();
|
||||||
Strings checksums(&csArray[0], &csArray[3]);
|
Strings checksums(&csArray[0], &csArray[3]);
|
||||||
|
@ -56,9 +57,11 @@ void ChunkChecksumValidatorTest::testValidate() {
|
||||||
CPPUNIT_ASSERT(bitfieldMan.isBitSet(0));
|
CPPUNIT_ASSERT(bitfieldMan.isBitSet(0));
|
||||||
CPPUNIT_ASSERT(!bitfieldMan.isBitSet(1));
|
CPPUNIT_ASSERT(!bitfieldMan.isBitSet(1));
|
||||||
CPPUNIT_ASSERT(bitfieldMan.isBitSet(2));
|
CPPUNIT_ASSERT(bitfieldMan.isBitSet(2));
|
||||||
|
#endif /* ENABLE_MESSAGE_DIGEST */
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChunkChecksumValidatorTest::testValidate2() {
|
void ChunkChecksumValidatorTest::testValidate2() {
|
||||||
|
#ifdef ENABLE_MESSAGE_DIGEST
|
||||||
BitfieldMan bitfieldMan(50, 250);
|
BitfieldMan bitfieldMan(50, 250);
|
||||||
bitfieldMan.setAllBit();
|
bitfieldMan.setAllBit();
|
||||||
Strings checksums(&csArray[0], &csArray[3]);
|
Strings checksums(&csArray[0], &csArray[3]);
|
||||||
|
@ -81,9 +84,11 @@ void ChunkChecksumValidatorTest::testValidate2() {
|
||||||
CPPUNIT_ASSERT(!bitfieldMan.isBitSet(2));
|
CPPUNIT_ASSERT(!bitfieldMan.isBitSet(2));
|
||||||
CPPUNIT_ASSERT(!bitfieldMan.isBitSet(3));
|
CPPUNIT_ASSERT(!bitfieldMan.isBitSet(3));
|
||||||
CPPUNIT_ASSERT(bitfieldMan.isBitSet(4));
|
CPPUNIT_ASSERT(bitfieldMan.isBitSet(4));
|
||||||
|
#endif /* ENABLE_MESSAGE_DIGEST */
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChunkChecksumValidatorTest::testValidate3() {
|
void ChunkChecksumValidatorTest::testValidate3() {
|
||||||
|
#ifdef ENABLE_MESSAGE_DIGEST
|
||||||
BitfieldMan bitfieldMan(50, 250);
|
BitfieldMan bitfieldMan(50, 250);
|
||||||
bitfieldMan.setAllBit();
|
bitfieldMan.setAllBit();
|
||||||
Strings checksums;
|
Strings checksums;
|
||||||
|
@ -108,9 +113,11 @@ void ChunkChecksumValidatorTest::testValidate3() {
|
||||||
CPPUNIT_ASSERT(!bitfieldMan.isBitSet(2));
|
CPPUNIT_ASSERT(!bitfieldMan.isBitSet(2));
|
||||||
CPPUNIT_ASSERT(!bitfieldMan.isBitSet(3));
|
CPPUNIT_ASSERT(!bitfieldMan.isBitSet(3));
|
||||||
CPPUNIT_ASSERT(!bitfieldMan.isBitSet(4));
|
CPPUNIT_ASSERT(!bitfieldMan.isBitSet(4));
|
||||||
|
#endif /* ENABLE_MESSAGE_DIGEST */
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChunkChecksumValidatorTest::testValidate4() {
|
void ChunkChecksumValidatorTest::testValidate4() {
|
||||||
|
#ifdef ENABLE_MESSAGE_DIGEST
|
||||||
BitfieldMan bitfieldMan(70, 250);
|
BitfieldMan bitfieldMan(70, 250);
|
||||||
bitfieldMan.setAllBit();
|
bitfieldMan.setAllBit();
|
||||||
Strings checksums(&csArray[0], &csArray[3]);
|
Strings checksums(&csArray[0], &csArray[3]);
|
||||||
|
@ -132,4 +139,5 @@ void ChunkChecksumValidatorTest::testValidate4() {
|
||||||
CPPUNIT_ASSERT(!bitfieldMan.isBitSet(1));
|
CPPUNIT_ASSERT(!bitfieldMan.isBitSet(1));
|
||||||
CPPUNIT_ASSERT(!bitfieldMan.isBitSet(2));
|
CPPUNIT_ASSERT(!bitfieldMan.isBitSet(2));
|
||||||
CPPUNIT_ASSERT(bitfieldMan.isBitSet(3));
|
CPPUNIT_ASSERT(bitfieldMan.isBitSet(3));
|
||||||
|
#endif /* ENABLE_MESSAGE_DIGEST */
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ void CookieBoxFactoryTest::testLoadDefaultCookie()
|
||||||
|
|
||||||
Cookies cookies = factory.getDefaultCookies();
|
Cookies cookies = factory.getDefaultCookies();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(4, (int32_t)cookies.size());
|
CPPUNIT_ASSERT_EQUAL((int32_t)4, (int32_t)cookies.size());
|
||||||
|
|
||||||
Cookie c = cookies[0];
|
Cookie c = cookies[0];
|
||||||
CPPUNIT_ASSERT_EQUAL(string("JSESSIONID"), c.name);
|
CPPUNIT_ASSERT_EQUAL(string("JSESSIONID"), c.name);
|
||||||
|
@ -60,5 +60,5 @@ void CookieBoxFactoryTest::testCreateNewInstance()
|
||||||
CookieBoxHandle box = factory.createNewInstance();
|
CookieBoxHandle box = factory.createNewInstance();
|
||||||
Cookies cookies = box->criteriaFind("localhost", "/", 0, true);
|
Cookies cookies = box->criteriaFind("localhost", "/", 0, true);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(4, (int32_t)cookies.size());
|
CPPUNIT_ASSERT_EQUAL((int32_t)4, (int32_t)cookies.size());
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ void CookieParserTest::testParse_file()
|
||||||
|
|
||||||
Cookies cookies = CookieParser().parse(f);
|
Cookies cookies = CookieParser().parse(f);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(3, (int32_t)cookies.size());
|
CPPUNIT_ASSERT_EQUAL((int32_t)3, (int32_t)cookies.size());
|
||||||
|
|
||||||
Cookie c = cookies[0];
|
Cookie c = cookies[0];
|
||||||
CPPUNIT_ASSERT_EQUAL(string("JSESSIONID"), c.name);
|
CPPUNIT_ASSERT_EQUAL(string("JSESSIONID"), c.name);
|
||||||
|
|
|
@ -54,7 +54,7 @@ void DefaultBtContextTest::testGetInfoHash() {
|
||||||
|
|
||||||
string correctHash = "248d0a1cd08284299de78d5c1ed359bb46717d8c";
|
string correctHash = "248d0a1cd08284299de78d5c1ed359bb46717d8c";
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(20, btContext.getInfoHashLength());
|
CPPUNIT_ASSERT_EQUAL((int32_t)20, btContext.getInfoHashLength());
|
||||||
CPPUNIT_ASSERT_EQUAL(correctHash, Util::toHex(btContext.getInfoHash(),
|
CPPUNIT_ASSERT_EQUAL(correctHash, Util::toHex(btContext.getInfoHash(),
|
||||||
btContext.getInfoHashLength()));
|
btContext.getInfoHashLength()));
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ void DefaultBtContextTest::testGetPieceLength() {
|
||||||
DefaultBtContext btContext;
|
DefaultBtContext btContext;
|
||||||
btContext.load("test.torrent");
|
btContext.load("test.torrent");
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(128,
|
CPPUNIT_ASSERT_EQUAL((int32_t)128,
|
||||||
btContext.getPieceLength());
|
btContext.getPieceLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -370,7 +370,7 @@ void DefaultBtMessageDispatcherTest::testIsSendingInProgress() {
|
||||||
void DefaultBtMessageDispatcherTest::testCountOutstandingRequest() {
|
void DefaultBtMessageDispatcherTest::testCountOutstandingRequest() {
|
||||||
RequestSlot slot(0, 0, MY_PIECE_LENGTH, 0);
|
RequestSlot slot(0, 0, MY_PIECE_LENGTH, 0);
|
||||||
btMessageDispatcher->addOutstandingRequest(slot);
|
btMessageDispatcher->addOutstandingRequest(slot);
|
||||||
CPPUNIT_ASSERT_EQUAL(1, btMessageDispatcher->countOutstandingRequest());
|
CPPUNIT_ASSERT_EQUAL((int32_t)1, btMessageDispatcher->countOutstandingRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefaultBtMessageDispatcherTest::testIsOutstandingRequest() {
|
void DefaultBtMessageDispatcherTest::testIsOutstandingRequest() {
|
||||||
|
|
|
@ -22,6 +22,8 @@ public:
|
||||||
CPPUNIT_TEST_SUITE_REGISTRATION( DefaultDiskWriterTest );
|
CPPUNIT_TEST_SUITE_REGISTRATION( DefaultDiskWriterTest );
|
||||||
|
|
||||||
void DefaultDiskWriterTest::testMessageDigest() {
|
void DefaultDiskWriterTest::testMessageDigest() {
|
||||||
|
#ifdef ENABLE_MESSAGE_DIGEST
|
||||||
|
|
||||||
DefaultDiskWriter dw;
|
DefaultDiskWriter dw;
|
||||||
dw.openExistingFile("4096chunk.txt");
|
dw.openExistingFile("4096chunk.txt");
|
||||||
|
|
||||||
|
@ -32,4 +34,5 @@ void DefaultDiskWriterTest::testMessageDigest() {
|
||||||
dw.messageDigest(5, 100, DIGEST_ALGO_SHA1));
|
dw.messageDigest(5, 100, DIGEST_ALGO_SHA1));
|
||||||
|
|
||||||
dw.closeFile();
|
dw.closeFile();
|
||||||
|
#endif // ENABLE_MESSAGE_DIGEST
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,13 +53,13 @@ CPPUNIT_TEST_SUITE_REGISTRATION(DefaultPeerStorageTest);
|
||||||
void DefaultPeerStorageTest::testCountPeer() {
|
void DefaultPeerStorageTest::testCountPeer() {
|
||||||
DefaultPeerStorage ps(btContext, option);
|
DefaultPeerStorage ps(btContext, option);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(0,
|
CPPUNIT_ASSERT_EQUAL((int32_t)0,
|
||||||
ps.countPeer());
|
ps.countPeer());
|
||||||
|
|
||||||
PeerHandle peer(new Peer("192.168.0.1", 6889, btContext->getPieceLength(),
|
PeerHandle peer(new Peer("192.168.0.1", 6889, btContext->getPieceLength(),
|
||||||
btContext->getTotalLength()));
|
btContext->getTotalLength()));
|
||||||
ps.addPeer(peer);
|
ps.addPeer(peer);
|
||||||
CPPUNIT_ASSERT_EQUAL(1,
|
CPPUNIT_ASSERT_EQUAL((int32_t)1,
|
||||||
ps.countPeer());
|
ps.countPeer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ void DefaultPeerStorageTest::testDeleteUnusedPeer() {
|
||||||
|
|
||||||
ps.deleteUnusedPeer(2);
|
ps.deleteUnusedPeer(2);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, ps.countPeer());
|
CPPUNIT_ASSERT_EQUAL((int32_t)1, ps.countPeer());
|
||||||
CPPUNIT_ASSERT_EQUAL(string("192.168.0.3"),
|
CPPUNIT_ASSERT_EQUAL(string("192.168.0.3"),
|
||||||
ps.getPeer("192.168.0.3", 6889)->ipaddr);
|
ps.getPeer("192.168.0.3", 6889)->ipaddr);
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ void DefaultPeerStorageTest::testDeleteUnusedPeer() {
|
||||||
ps.deleteUnusedPeer(3);
|
ps.deleteUnusedPeer(3);
|
||||||
|
|
||||||
// peer2 has been in use, so it did't deleted.
|
// peer2 has been in use, so it did't deleted.
|
||||||
CPPUNIT_ASSERT_EQUAL(1, ps.countPeer());
|
CPPUNIT_ASSERT_EQUAL((int32_t)1, ps.countPeer());
|
||||||
CPPUNIT_ASSERT_EQUAL(string("192.168.0.2"),
|
CPPUNIT_ASSERT_EQUAL(string("192.168.0.2"),
|
||||||
ps.getPeer("192.168.0.2", 6889)->ipaddr);
|
ps.getPeer("192.168.0.2", 6889)->ipaddr);
|
||||||
|
|
||||||
|
@ -111,13 +111,13 @@ void DefaultPeerStorageTest::testAddPeer() {
|
||||||
ps.addPeer(peer2);
|
ps.addPeer(peer2);
|
||||||
ps.addPeer(peer3);
|
ps.addPeer(peer3);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(3, ps.countPeer());
|
CPPUNIT_ASSERT_EQUAL((int32_t)3, ps.countPeer());
|
||||||
|
|
||||||
// this is true, because peer1 in the container has no errors and
|
// this is true, because peer1 in the container has no errors and
|
||||||
// it is replaced by peer1(self assignment).
|
// it is replaced by peer1(self assignment).
|
||||||
CPPUNIT_ASSERT_EQUAL(true, ps.addPeer(peer1));
|
CPPUNIT_ASSERT_EQUAL(true, ps.addPeer(peer1));
|
||||||
// the number of peers doesn't change.
|
// the number of peers doesn't change.
|
||||||
CPPUNIT_ASSERT_EQUAL(3, ps.countPeer());
|
CPPUNIT_ASSERT_EQUAL((int32_t)3, ps.countPeer());
|
||||||
|
|
||||||
ps.setMaxPeerListSize(3);
|
ps.setMaxPeerListSize(3);
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ void DefaultPeerStorageTest::testAddPeer() {
|
||||||
|
|
||||||
CPPUNIT_ASSERT(ps.addPeer(peer4));
|
CPPUNIT_ASSERT(ps.addPeer(peer4));
|
||||||
// peer1 was deleted.
|
// peer1 was deleted.
|
||||||
CPPUNIT_ASSERT_EQUAL(3, ps.countPeer());
|
CPPUNIT_ASSERT_EQUAL((int32_t)3, ps.countPeer());
|
||||||
|
|
||||||
peer4->startBadCondition();
|
peer4->startBadCondition();
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,11 @@ void FileTest::testRemove() {
|
||||||
CPPUNIT_ASSERT(!f.remove());
|
CPPUNIT_ASSERT(!f.remove());
|
||||||
|
|
||||||
string dir = "/tmp/aria2testdir";
|
string dir = "/tmp/aria2testdir";
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
mkdir(dir.c_str());
|
||||||
|
#else
|
||||||
mkdir(dir.c_str(), 0777);
|
mkdir(dir.c_str(), 0777);
|
||||||
|
#endif // __MINGW32__
|
||||||
File d(dir);
|
File d(dir);
|
||||||
CPPUNIT_ASSERT(d.exists());
|
CPPUNIT_ASSERT(d.exists());
|
||||||
CPPUNIT_ASSERT(d.remove());
|
CPPUNIT_ASSERT(d.remove());
|
||||||
|
|
|
@ -61,7 +61,7 @@ void HttpHeaderProcessorTest::testGetPutBackDataLength()
|
||||||
"\r\nputbackme";
|
"\r\nputbackme";
|
||||||
proc.update(hd1);
|
proc.update(hd1);
|
||||||
CPPUNIT_ASSERT(proc.eoh());
|
CPPUNIT_ASSERT(proc.eoh());
|
||||||
CPPUNIT_ASSERT_EQUAL(9, proc.getPutBackDataLength());
|
CPPUNIT_ASSERT_EQUAL((int32_t)9, proc.getPutBackDataLength());
|
||||||
|
|
||||||
proc.clear();
|
proc.clear();
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ void HttpHeaderProcessorTest::testGetPutBackDataLength()
|
||||||
"\nputbackme";
|
"\nputbackme";
|
||||||
proc.update(hd2);
|
proc.update(hd2);
|
||||||
CPPUNIT_ASSERT(proc.eoh());
|
CPPUNIT_ASSERT(proc.eoh());
|
||||||
CPPUNIT_ASSERT_EQUAL(9, proc.getPutBackDataLength());
|
CPPUNIT_ASSERT_EQUAL((int32_t)9, proc.getPutBackDataLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
void HttpHeaderProcessorTest::testGetPutBackDataLength_nullChar()
|
void HttpHeaderProcessorTest::testGetPutBackDataLength_nullChar()
|
||||||
|
@ -79,7 +79,7 @@ void HttpHeaderProcessorTest::testGetPutBackDataLength_nullChar()
|
||||||
"foo: foo\0bar\r\n"
|
"foo: foo\0bar\r\n"
|
||||||
"\r\nputbackme", 35+7);
|
"\r\nputbackme", 35+7);
|
||||||
CPPUNIT_ASSERT(proc.eoh());
|
CPPUNIT_ASSERT(proc.eoh());
|
||||||
CPPUNIT_ASSERT_EQUAL(9, proc.getPutBackDataLength());
|
CPPUNIT_ASSERT_EQUAL((int32_t)9, proc.getPutBackDataLength());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,13 +36,9 @@ aria2c_SOURCES = AllTest.cc\
|
||||||
DictionaryTest.cc\
|
DictionaryTest.cc\
|
||||||
ListTest.cc\
|
ListTest.cc\
|
||||||
MetaFileUtilTest.cc\
|
MetaFileUtilTest.cc\
|
||||||
ShaVisitorTest.cc\
|
|
||||||
PeerMessageUtilTest.cc\
|
PeerMessageUtilTest.cc\
|
||||||
DefaultDiskWriterTest.cc\
|
DefaultDiskWriterTest.cc\
|
||||||
MultiDiskAdaptorTest.cc\
|
MultiDiskAdaptorTest.cc\
|
||||||
Xml2MetalinkProcessorTest.cc\
|
|
||||||
MetalinkerTest.cc\
|
|
||||||
MetalinkEntryTest.cc\
|
|
||||||
FeatureConfigTest.cc\
|
FeatureConfigTest.cc\
|
||||||
ShareRatioSeedCriteriaTest.cc\
|
ShareRatioSeedCriteriaTest.cc\
|
||||||
TimeSeedCriteriaTest.cc\
|
TimeSeedCriteriaTest.cc\
|
||||||
|
@ -50,17 +46,17 @@ aria2c_SOURCES = AllTest.cc\
|
||||||
DefaultPeerListProcessorTest.cc\
|
DefaultPeerListProcessorTest.cc\
|
||||||
AnnounceListTest.cc\
|
AnnounceListTest.cc\
|
||||||
TrackerWatcherCommandTest.cc\
|
TrackerWatcherCommandTest.cc\
|
||||||
DefaultBtContextTest.cc\
|
|
||||||
DefaultPieceStorageTest.cc\
|
|
||||||
DefaultBtAnnounceTest.cc\
|
|
||||||
BtRegistryTest.cc\
|
|
||||||
DefaultBtMessageDispatcherTest.cc\
|
|
||||||
MockPeerStorage.h\
|
MockPeerStorage.h\
|
||||||
DefaultBtRequestFactoryTest.cc\
|
FixedNumberRandomizer.h\
|
||||||
BtAllowedFastMessageTest.cc\
|
ConsoleFileAllocationMonitorTest.cc\
|
||||||
|
ChunkChecksumValidatorTest.cc
|
||||||
|
|
||||||
|
if ENABLE_BITTORRENT
|
||||||
|
aria2c_SOURCES += BtAllowedFastMessageTest.cc\
|
||||||
BtBitfieldMessageTest.cc\
|
BtBitfieldMessageTest.cc\
|
||||||
BtCancelMessageTest.cc\
|
BtCancelMessageTest.cc\
|
||||||
BtChokeMessageTest.cc\
|
BtChokeMessageTest.cc\
|
||||||
|
BtHandshakeMessageTest.cc\
|
||||||
BtHaveAllMessageTest.cc\
|
BtHaveAllMessageTest.cc\
|
||||||
BtHaveMessageTest.cc\
|
BtHaveMessageTest.cc\
|
||||||
BtHaveNoneMessageTest.cc\
|
BtHaveNoneMessageTest.cc\
|
||||||
|
@ -69,24 +65,37 @@ aria2c_SOURCES = AllTest.cc\
|
||||||
BtNotInterestedMessageTest.cc\
|
BtNotInterestedMessageTest.cc\
|
||||||
BtPieceMessageTest.cc\
|
BtPieceMessageTest.cc\
|
||||||
BtPortMessageTest.cc\
|
BtPortMessageTest.cc\
|
||||||
|
BtRegistryTest.cc\
|
||||||
BtRejectMessageTest.cc\
|
BtRejectMessageTest.cc\
|
||||||
BtRequestMessageTest.cc\
|
BtRequestMessageTest.cc\
|
||||||
BtSuggestPieceMessageTest.cc\
|
BtSuggestPieceMessageTest.cc\
|
||||||
BtUnchokeMessageTest.cc\
|
BtUnchokeMessageTest.cc\
|
||||||
BtHandshakeMessageTest.cc\
|
DefaultBtAnnounceTest.cc\
|
||||||
MockBtMessageDispatcher.h\
|
DefaultBtContextTest.cc\
|
||||||
FixedNumberRandomizer.h\
|
DefaultBtMessageDispatcherTest.cc\
|
||||||
MockBtMessageFactory.h\
|
DefaultBtRequestFactoryTest.cc\
|
||||||
|
DefaultPieceStorageTest.cc\
|
||||||
MockBtMessage.h\
|
MockBtMessage.h\
|
||||||
ConsoleFileAllocationMonitorTest.cc\
|
MockBtMessageDispatcher.h\
|
||||||
ChunkChecksumValidatorTest.cc
|
MockBtMessageFactory.h\
|
||||||
|
ShaVisitorTest.cc
|
||||||
|
endif # ENABLE_BITTORRENT
|
||||||
|
|
||||||
|
if ENABLE_METALINK
|
||||||
|
aria2c_SOURCES += MetalinkerTest.cc\
|
||||||
|
MetalinkEntryTest.cc\
|
||||||
|
Xml2MetalinkProcessorTest.cc
|
||||||
|
endif # ENABLE_METALINK
|
||||||
|
|
||||||
|
|
||||||
#aria2c_CXXFLAGS = ${CPPUNIT_CFLAGS} -I../src -I../lib -Wall -D_FILE_OFFSET_BITS=64
|
#aria2c_CXXFLAGS = ${CPPUNIT_CFLAGS} -I../src -I../lib -Wall -D_FILE_OFFSET_BITS=64
|
||||||
#aria2c_LDFLAGS = ${CPPUNIT_LIBS}
|
#aria2c_LDFLAGS = ${CPPUNIT_LIBS}
|
||||||
|
|
||||||
aria2c_LDADD = ../src/libaria2c.a\
|
aria2c_LDADD = ../src/libaria2c.a\
|
||||||
${CPPUNIT_LIBS} @LIBGNUTLS_LIBS@\
|
@LIBINTL@ @LIBGNUTLS_LIBS@\
|
||||||
@LIBGCRYPT_LIBS@ @OPENSSL_LIBS@ @XML_LIBS@\
|
@LIBGCRYPT_LIBS@ @OPENSSL_LIBS@ @XML_LIBS@ @LIBARES_LIBS@\
|
||||||
@LIBARES_LIBS@ @LIBCARES_LIBS@
|
@LIBCARES_LIBS@ @WINSOCK_LIBS@\
|
||||||
|
${CPPUNIT_LIBS}
|
||||||
AM_CPPFLAGS = -Wall\
|
AM_CPPFLAGS = -Wall\
|
||||||
${CPPUNIT_CFLAGS}\
|
${CPPUNIT_CFLAGS}\
|
||||||
-I ../src\
|
-I ../src\
|
||||||
|
|
|
@ -9,7 +9,9 @@ class MultiDiskAdaptorTest:public CppUnit::TestFixture {
|
||||||
CPPUNIT_TEST_SUITE(MultiDiskAdaptorTest);
|
CPPUNIT_TEST_SUITE(MultiDiskAdaptorTest);
|
||||||
CPPUNIT_TEST(testWriteData);
|
CPPUNIT_TEST(testWriteData);
|
||||||
CPPUNIT_TEST(testReadData);
|
CPPUNIT_TEST(testReadData);
|
||||||
|
#ifdef ENABLE_MESSAGE_DIGEST
|
||||||
CPPUNIT_TEST(testMessageDigest);
|
CPPUNIT_TEST(testMessageDigest);
|
||||||
|
#endif // ENABLE_MESSAGE_DIGEST
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
private:
|
private:
|
||||||
Option* option;
|
Option* option;
|
||||||
|
@ -30,7 +32,9 @@ public:
|
||||||
|
|
||||||
void testWriteData();
|
void testWriteData();
|
||||||
void testReadData();
|
void testReadData();
|
||||||
|
#ifdef ENABLE_MESSAGE_DIGEST
|
||||||
void testMessageDigest();
|
void testMessageDigest();
|
||||||
|
#endif // ENABLE_MESSAGE_DIGEST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -134,6 +138,8 @@ void MultiDiskAdaptorTest::testReadData() {
|
||||||
CPPUNIT_ASSERT_EQUAL(string("1234567890ABCDEFGHIJKLMNO"), string((char*)buf));
|
CPPUNIT_ASSERT_EQUAL(string("1234567890ABCDEFGHIJKLMNO"), string((char*)buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_MESSAGE_DIGEST
|
||||||
|
|
||||||
void MultiDiskAdaptorTest::testMessageDigest() {
|
void MultiDiskAdaptorTest::testMessageDigest() {
|
||||||
FileEntryHandle entry1(new FileEntry("file1r.txt", 15, 0));
|
FileEntryHandle entry1(new FileEntry("file1r.txt", 15, 0));
|
||||||
FileEntryHandle entry2(new FileEntry("file2r.txt", 7, 15));
|
FileEntryHandle entry2(new FileEntry("file2r.txt", 7, 15));
|
||||||
|
@ -154,3 +160,5 @@ void MultiDiskAdaptorTest::testMessageDigest() {
|
||||||
CPPUNIT_ASSERT_EQUAL(string("6238bf61dd8df8f77156b2378e9e39cd3939680c"), sha1sum);
|
CPPUNIT_ASSERT_EQUAL(string("6238bf61dd8df8f77156b2378e9e39cd3939680c"), sha1sum);
|
||||||
adaptor->closeFile();
|
adaptor->closeFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // ENABLE_MESSAGE_DIGEST
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
|
#include "common.h"
|
||||||
#include "MultiDiskWriter.h"
|
#include "MultiDiskWriter.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cppunit/extensions/HelperMacros.h>
|
#include <cppunit/extensions/HelperMacros.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_IO_H
|
||||||
|
# include <io.h>
|
||||||
|
#endif // HAVE_IO_H
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
class MultiDiskWriterTest:public CppUnit::TestFixture {
|
class MultiDiskWriterTest:public CppUnit::TestFixture {
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
|
#include "common.h"
|
||||||
#include "PeerMessageUtil.h"
|
#include "PeerMessageUtil.h"
|
||||||
|
#ifdef HAVE_NETINET_IN_H
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
#endif // HAVE_NETINET_IN_H
|
||||||
#include <cppunit/extensions/HelperMacros.h>
|
#include <cppunit/extensions/HelperMacros.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
|
@ -146,7 +146,7 @@ void SegmentManTest::testMarkPieceDone_usedSegment()
|
||||||
SegmentHandle segment = segmentMan.getSegment(0, 5);
|
SegmentHandle segment = segmentMan.getSegment(0, 5);
|
||||||
CPPUNIT_ASSERT(!segment.isNull());
|
CPPUNIT_ASSERT(!segment.isNull());
|
||||||
CPPUNIT_ASSERT_EQUAL(5, segment->index);
|
CPPUNIT_ASSERT_EQUAL(5, segment->index);
|
||||||
CPPUNIT_ASSERT_EQUAL(pieceLength, segment->length);
|
CPPUNIT_ASSERT_EQUAL(pieceLength, (int32_t) segment->length);
|
||||||
CPPUNIT_ASSERT_EQUAL(pieceLength, segment->segmentLength);
|
CPPUNIT_ASSERT_EQUAL(pieceLength, (int32_t) segment->segmentLength);
|
||||||
CPPUNIT_ASSERT_EQUAL(100, segment->writtenLength);
|
CPPUNIT_ASSERT_EQUAL(100, segment->writtenLength);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "ShaVisitor.h"
|
#include "ShaVisitor.h"
|
||||||
|
|
||||||
#include "MetaFileUtil.h"
|
#include "MetaFileUtil.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cppunit/extensions/HelperMacros.h>
|
#include <cppunit/extensions/HelperMacros.h>
|
||||||
|
@ -10,6 +11,7 @@ class ShaVisitorTest:public CppUnit::TestFixture {
|
||||||
CPPUNIT_TEST_SUITE(ShaVisitorTest);
|
CPPUNIT_TEST_SUITE(ShaVisitorTest);
|
||||||
CPPUNIT_TEST(testVisit);
|
CPPUNIT_TEST(testVisit);
|
||||||
CPPUNIT_TEST(testVisitCompound);
|
CPPUNIT_TEST(testVisitCompound);
|
||||||
|
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -34,21 +34,21 @@ void SharedHandleTest::testSharedHandle() {
|
||||||
cerr << "xh:" << endl;
|
cerr << "xh:" << endl;
|
||||||
SharedHandle<int> xh = new int(1);
|
SharedHandle<int> xh = new int(1);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, xh.getRefCount()->totalRefCount);
|
CPPUNIT_ASSERT_EQUAL((int32_t)1, xh.getRefCount()->totalRefCount);
|
||||||
CPPUNIT_ASSERT_EQUAL(1, xh.getRefCount()->strongRefCount);
|
CPPUNIT_ASSERT_EQUAL((int32_t)1, xh.getRefCount()->strongRefCount);
|
||||||
|
|
||||||
cerr << "nullHandle:" << endl;
|
cerr << "nullHandle:" << endl;
|
||||||
SharedHandle<int> nullHandle = 0;
|
SharedHandle<int> nullHandle = 0;
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, nullHandle.getRefCount()->totalRefCount);
|
CPPUNIT_ASSERT_EQUAL((int32_t)1, nullHandle.getRefCount()->totalRefCount);
|
||||||
CPPUNIT_ASSERT_EQUAL(1, nullHandle.getRefCount()->strongRefCount);
|
CPPUNIT_ASSERT_EQUAL((int32_t)1, nullHandle.getRefCount()->strongRefCount);
|
||||||
|
|
||||||
cerr << "staticHandle:" << endl;
|
cerr << "staticHandle:" << endl;
|
||||||
CPPUNIT_ASSERT_EQUAL(1, staticHandle.getRefCount()->totalRefCount);
|
CPPUNIT_ASSERT_EQUAL((int32_t)1, staticHandle.getRefCount()->totalRefCount);
|
||||||
CPPUNIT_ASSERT_EQUAL(1, staticHandle.getRefCount()->strongRefCount);
|
CPPUNIT_ASSERT_EQUAL((int32_t)1, staticHandle.getRefCount()->strongRefCount);
|
||||||
|
|
||||||
SharedHandle<int> localStaticHandle = getInstance();
|
SharedHandle<int> localStaticHandle = getInstance();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(2, localStaticHandle.getRefCount()->totalRefCount);
|
CPPUNIT_ASSERT_EQUAL((int32_t)2, localStaticHandle.getRefCount()->totalRefCount);
|
||||||
CPPUNIT_ASSERT_EQUAL(2, localStaticHandle.getRefCount()->strongRefCount);
|
CPPUNIT_ASSERT_EQUAL((int32_t)2, localStaticHandle.getRefCount()->strongRefCount);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include <iostream>
|
||||||
#include "SingletonHolder.h"
|
#include "SingletonHolder.h"
|
||||||
#include "SharedHandle.h"
|
#include "SharedHandle.h"
|
||||||
#include <cppunit/extensions/HelperMacros.h>
|
#include <cppunit/extensions/HelperMacros.h>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "TimeSeedCriteria.h"
|
#include "TimeSeedCriteria.h"
|
||||||
|
|
||||||
#include <cppunit/extensions/HelperMacros.h>
|
#include <cppunit/extensions/HelperMacros.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
class TimeSeedCriteriaTest:public CppUnit::TestFixture {
|
class TimeSeedCriteriaTest:public CppUnit::TestFixture {
|
||||||
|
|
||||||
|
@ -17,7 +18,11 @@ CPPUNIT_TEST_SUITE_REGISTRATION(TimeSeedCriteriaTest);
|
||||||
|
|
||||||
void TimeSeedCriteriaTest::testEvaluate() {
|
void TimeSeedCriteriaTest::testEvaluate() {
|
||||||
TimeSeedCriteria cri(1);
|
TimeSeedCriteria cri(1);
|
||||||
|
#ifdef HAVE_SLEEP
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
#else
|
||||||
|
_sleep(1);
|
||||||
|
#endif
|
||||||
CPPUNIT_ASSERT(cri.evaluate());
|
CPPUNIT_ASSERT(cri.evaluate());
|
||||||
cri.reset();
|
cri.reset();
|
||||||
cri.setDuration(10);
|
cri.setDuration(10);
|
||||||
|
|
|
@ -15,9 +15,13 @@ class UtilTest:public CppUnit::TestFixture {
|
||||||
CPPUNIT_TEST(testStartsWith);
|
CPPUNIT_TEST(testStartsWith);
|
||||||
// may be moved to other helper class in the future.
|
// may be moved to other helper class in the future.
|
||||||
CPPUNIT_TEST(testGetContentDispositionFilename);
|
CPPUNIT_TEST(testGetContentDispositionFilename);
|
||||||
|
#ifdef ENABLE_BITTORRENT
|
||||||
CPPUNIT_TEST(testComputeFastSet);
|
CPPUNIT_TEST(testComputeFastSet);
|
||||||
|
#endif
|
||||||
CPPUNIT_TEST(testRandomAlpha);
|
CPPUNIT_TEST(testRandomAlpha);
|
||||||
|
#ifdef ENABLE_MESSAGE_DIGEST
|
||||||
CPPUNIT_TEST(testFileChecksum);
|
CPPUNIT_TEST(testFileChecksum);
|
||||||
|
#endif
|
||||||
CPPUNIT_TEST(testToUpper);
|
CPPUNIT_TEST(testToUpper);
|
||||||
CPPUNIT_TEST(testToLower);
|
CPPUNIT_TEST(testToLower);
|
||||||
CPPUNIT_TEST(testUrldecode);
|
CPPUNIT_TEST(testUrldecode);
|
||||||
|
@ -38,11 +42,15 @@ public:
|
||||||
void testEndsWith();
|
void testEndsWith();
|
||||||
void testReplace();
|
void testReplace();
|
||||||
void testStartsWith();
|
void testStartsWith();
|
||||||
|
#ifdef ENABLE_BITTORRENT
|
||||||
void testComputeFastSet();
|
void testComputeFastSet();
|
||||||
|
#endif
|
||||||
// may be moved to other helper class in the future.
|
// may be moved to other helper class in the future.
|
||||||
void testGetContentDispositionFilename();
|
void testGetContentDispositionFilename();
|
||||||
void testRandomAlpha();
|
void testRandomAlpha();
|
||||||
|
#ifdef ENABLE_MESSAGE_DIGEST
|
||||||
void testFileChecksum();
|
void testFileChecksum();
|
||||||
|
#endif
|
||||||
void testToUpper();
|
void testToUpper();
|
||||||
void testToLower();
|
void testToLower();
|
||||||
void testUrldecode();
|
void testUrldecode();
|
||||||
|
@ -235,6 +243,8 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef ENABLE_BITTORRENT
|
||||||
|
|
||||||
void UtilTest::testComputeFastSet() {
|
void UtilTest::testComputeFastSet() {
|
||||||
string ipaddr = "192.168.0.1";
|
string ipaddr = "192.168.0.1";
|
||||||
unsigned char infoHash[20];
|
unsigned char infoHash[20];
|
||||||
|
@ -258,10 +268,14 @@ void UtilTest::testComputeFastSet() {
|
||||||
CPPUNIT_ASSERT(equal(fastSet.begin(), fastSet.end(), ansSet2.begin()));
|
CPPUNIT_ASSERT(equal(fastSet.begin(), fastSet.end(), ansSet2.begin()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
void UtilTest::testRandomAlpha() {
|
void UtilTest::testRandomAlpha() {
|
||||||
CPPUNIT_ASSERT_EQUAL(string("rUopvKRn"), Util::randomAlpha(8));
|
CPPUNIT_ASSERT_EQUAL(string("rUopvKRn"), Util::randomAlpha(8));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_MESSAGE_DIGEST
|
||||||
|
|
||||||
void UtilTest::testFileChecksum() {
|
void UtilTest::testFileChecksum() {
|
||||||
unsigned char buf[20];
|
unsigned char buf[20];
|
||||||
string filename = "4096chunk.txt";
|
string filename = "4096chunk.txt";
|
||||||
|
@ -276,6 +290,8 @@ void UtilTest::testFileChecksum() {
|
||||||
md5);
|
md5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
void UtilTest::testToUpper() {
|
void UtilTest::testToUpper() {
|
||||||
string src = "608cabc0f2fa18c260cafd974516865c772363d5";
|
string src = "608cabc0f2fa18c260cafd974516865c772363d5";
|
||||||
string upp = "608CABC0F2FA18C260CAFD974516865C772363D5";
|
string upp = "608CABC0F2FA18C260CAFD974516865C772363D5";
|
||||||
|
@ -314,8 +330,8 @@ void UtilTest::testUrldecode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void UtilTest::testCountBit() {
|
void UtilTest::testCountBit() {
|
||||||
CPPUNIT_ASSERT_EQUAL(32, Util::countBit(UINT32_MAX));
|
CPPUNIT_ASSERT_EQUAL((int32_t)32, Util::countBit(UINT32_MAX));
|
||||||
CPPUNIT_ASSERT_EQUAL(8, Util::countBit(255));
|
CPPUNIT_ASSERT_EQUAL((int32_t)8, Util::countBit(255));
|
||||||
}
|
}
|
||||||
|
|
||||||
void UtilTest::testGetRealSize()
|
void UtilTest::testGetRealSize()
|
||||||
|
|
|
@ -64,10 +64,12 @@ void Xml2MetalinkProcessorTest::testParseFile() {
|
||||||
CPPUNIT_ASSERT_EQUAL(string("0.5.1"), entry2->version);
|
CPPUNIT_ASSERT_EQUAL(string("0.5.1"), entry2->version);
|
||||||
CPPUNIT_ASSERT_EQUAL(string("ja-JP"), entry2->language);
|
CPPUNIT_ASSERT_EQUAL(string("ja-JP"), entry2->language);
|
||||||
CPPUNIT_ASSERT_EQUAL(string("Linux-m68k"), entry2->os);
|
CPPUNIT_ASSERT_EQUAL(string("Linux-m68k"), entry2->os);
|
||||||
|
#ifdef ENABLE_MESSAGE_DIGEST
|
||||||
CPPUNIT_ASSERT_EQUAL(string("4c255b0ed130f5ea880f0aa061c3da0487e251cc"),
|
CPPUNIT_ASSERT_EQUAL(string("4c255b0ed130f5ea880f0aa061c3da0487e251cc"),
|
||||||
entry2->checksum->getMessageDigest());
|
entry2->checksum->getMessageDigest());
|
||||||
|
#endif // ENABLE_MESSAGE_DIGEST
|
||||||
CPPUNIT_ASSERT_EQUAL((int32_t)2, entry2->chunkChecksum->countChecksum());
|
CPPUNIT_ASSERT_EQUAL((int32_t)2, entry2->chunkChecksum->countChecksum());
|
||||||
CPPUNIT_ASSERT_EQUAL(262144, entry2->chunkChecksum->getChecksumLength());
|
CPPUNIT_ASSERT_EQUAL((int32_t)262144, entry2->chunkChecksum->getChecksumLength());
|
||||||
CPPUNIT_ASSERT_EQUAL(string("179463a88d79cbf0b1923991708aead914f26142"),
|
CPPUNIT_ASSERT_EQUAL(string("179463a88d79cbf0b1923991708aead914f26142"),
|
||||||
entry2->chunkChecksum->getChecksum(0));
|
entry2->chunkChecksum->getChecksum(0));
|
||||||
CPPUNIT_ASSERT_EQUAL(string("fecf8bc9a1647505fe16746f94e97a477597dbf3"),
|
CPPUNIT_ASSERT_EQUAL(string("fecf8bc9a1647505fe16746f94e97a477597dbf3"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue