mirror of
https://github.com/aria2/aria2.git
synced 2025-04-05 21:47:37 +03:00
2007-08-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
MessageDigestHelper is introduced in order to simplify the use of message digest. Removed repeated code. The message digest algorithm is now specified by string, like "sha1", "md5". * src/messageDigest.{h, cc} * src/MessageDigestHelper.{h, cc}: New class. * src/DefaultPieceStorage.cc * src/DefaultBtContext.{h, cc} (computeFastSet): New function. (setInfoHash): Added for unit testing. (setNumPieces): Added for unit testing. * src/DefaultBtInteractive.cc * src/BtPieceMessage.cc * src/Peer.cc * src/Checksum.h * src/message.h * src/IteratableChecksumValidator.h * src/ChunkChecksumValidator.{h, cc}: Use IteratableChecksumValidator inside it. * src/SegmentMan.{h, cc} (checkIntegrity): Removed. * src/IteratableChunkChecksumValidator.{h, cc} * src/Util.h (sha1Sum): Removed. (simpleMessageDigest): Removed. (fileChecksum): Removed. (computeFastSet): Removed. * src/ShaVisitor.cc * src/ChunkChecksum.h * src/DownloadCommand.cc Removed messageDigest virtual functions. * src/MultiDiskAdaptor.{h, cc} * src/DiskAdaptor.h * src/ByteArrayDiskWriter.h * src/DiskWriter.h * src/DiskAdaptorWriter.h * src/AbstractSingleDiskAdaptor.{h, cc} * src/AbstractDiskWriter.{h, cc} Fixed comilation error when message digest is disabled. * src/MetalinkEntry.{h, cc} * src/MetalinkRequestInfo.cc Removed srandom and random. * src/SimpleRandomizer.h Added size() virtual function to DiskAdaptor * src/MultiDiskAdaptor.h Fixed the bug that causes that files are not opened correctly in multi-file torrent. * src/TorrentRequestInfo.cc * src/MultiDiskAdaptor.cc Added SHA256 support * src/messageDigest.cc * src/Xml2MetalinkProcessor.cc Show supported message digest algorithms * src/main.cc Updated contact info. * src/main.cc
This commit is contained in:
parent
45f949c713
commit
e85f9ccfd6
67 changed files with 1230 additions and 787 deletions
|
@ -1,5 +1,4 @@
|
|||
#include "DefaultDiskWriter.h"
|
||||
#include <string>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
using namespace std;
|
||||
|
@ -7,7 +6,7 @@ using namespace std;
|
|||
class DefaultDiskWriterTest:public CppUnit::TestFixture {
|
||||
|
||||
CPPUNIT_TEST_SUITE(DefaultDiskWriterTest);
|
||||
CPPUNIT_TEST(testMessageDigest);
|
||||
CPPUNIT_TEST(testSize);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
private:
|
||||
|
||||
|
@ -15,24 +14,16 @@ public:
|
|||
void setUp() {
|
||||
}
|
||||
|
||||
void testMessageDigest();
|
||||
void testSize();
|
||||
};
|
||||
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION( DefaultDiskWriterTest );
|
||||
|
||||
void DefaultDiskWriterTest::testMessageDigest() {
|
||||
#ifdef ENABLE_MESSAGE_DIGEST
|
||||
|
||||
void DefaultDiskWriterTest::testSize()
|
||||
{
|
||||
DefaultDiskWriter dw;
|
||||
dw.openExistingFile("4096chunk.txt");
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(string("608cabc0f2fa18c260cafd974516865c772363d5"),
|
||||
dw.messageDigest(0, 4096, DIGEST_ALGO_SHA1));
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(string("7a4a9ae537ebbbb826b1060e704490ad0f365ead"),
|
||||
dw.messageDigest(5, 100, DIGEST_ALGO_SHA1));
|
||||
|
||||
dw.closeFile();
|
||||
#endif // ENABLE_MESSAGE_DIGEST
|
||||
CPPUNIT_ASSERT_EQUAL((int64_t)4096, dw.size());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue