mirror of
https://github.com/aria2/aria2.git
synced 2025-04-05 05:27:38 +03:00
2007-10-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Throw exception when chunck checksum verification fails. * src/DownloadCommand.cc (validatePieceHash): New function. * src/PiecedSegment.{h, cc} (clear): New function. * src/GrowSegment.{h, cc} (clear): New function. * src/Segment.h (clear): New function. * src/SegmentMan.{h, cc} (validatePieceHash): Removed. * test/SegmentTest.cc * test/GrowSegmentTest.cc
This commit is contained in:
parent
1d5834a6ca
commit
1171a2063f
12 changed files with 96 additions and 123 deletions
|
@ -8,6 +8,7 @@ class GrowSegmentTest : public CppUnit::TestFixture {
|
|||
|
||||
CPPUNIT_TEST_SUITE(GrowSegmentTest);
|
||||
CPPUNIT_TEST(testUpdateWrittenLength);
|
||||
CPPUNIT_TEST(testClear);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
private:
|
||||
|
||||
|
@ -15,6 +16,7 @@ public:
|
|||
void setUp() {}
|
||||
|
||||
void testUpdateWrittenLength();
|
||||
void testClear();
|
||||
};
|
||||
|
||||
|
||||
|
@ -29,3 +31,12 @@ void GrowSegmentTest::testUpdateWrittenLength()
|
|||
CPPUNIT_ASSERT(!segment.complete());
|
||||
CPPUNIT_ASSERT(segment.getPiece()->pieceComplete());
|
||||
}
|
||||
|
||||
void GrowSegmentTest::testClear()
|
||||
{
|
||||
GrowSegment segment(new Piece());
|
||||
segment.updateWrittenLength(32*1024);
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)32*1024, segment.getWrittenLength());
|
||||
segment.clear();
|
||||
CPPUNIT_ASSERT_EQUAL((int32_t)0, segment.getWrittenLength());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue