2008-03-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>

Added a test for large file.
	* test/MetalinkProcessorTest.cc (testLargeFileSize):
pull/1/head
Tatsuhiro Tsujikawa 2008-03-01 06:07:10 +00:00
parent 067ef72e5e
commit 3f17f5ffd7
2 changed files with 34 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2008-03-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added a test for large file.
* test/MetalinkProcessorTest.cc (testLargeFileSize):
2008-03-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed the bug that file size is ignored if size > INT32_MAX

View File

@ -34,6 +34,7 @@ class MetalinkProcessorTest:public CppUnit::TestFixture {
CPPUNIT_TEST(testBadPieceLength);
CPPUNIT_TEST(testUnsupportedType_piece);
#endif // ENABLE_MESSAGE_DIGEST
CPPUNIT_TEST(testLargeFileSize);
CPPUNIT_TEST_SUITE_END();
private:
@ -54,6 +55,7 @@ public:
void testBadPieceLength();
void testUnsupportedType_piece();
#endif // ENABLE_MESSAGE_DIGEST
void testLargeFileSize();
};
@ -519,4 +521,31 @@ void MetalinkProcessorTest::testUnsupportedType_piece()
}
#endif // ENABLE_MESSAGE_DIGEST
void MetalinkProcessorTest::testLargeFileSize()
{
SharedHandle<MetalinkProcessor> proc = MetalinkProcessorFactory::newInstance();
SharedHandle<ByteArrayDiskWriter> dw = new ByteArrayDiskWriter();
dw->setString("<metalink>"
"<files>"
"<file name=\"dvd.iso\">"
" <size>9223372036854775807</size>"
" <resources>"
" <url type=\"http\">ftp://mirror/</url>"
" </resources>"
"</file>"
"</files>"
"</metalink>");
try {
SharedHandle<Metalinker> m = proc->parseFromBinaryStream(dw);
SharedHandle<MetalinkEntry> e = m->entries[0];
CPPUNIT_ASSERT_EQUAL(9223372036854775807LL, e->getLength());
} catch(Exception* e) {
std::cerr << *e << std::endl;
std::string m = e->getMsg();
delete e;
CPPUNIT_FAIL(m);
}
}
} // namespace aria2