aria2/test/MetalinkPostDownloadHandlerTest.cc
Tatsuhiro Tsujikawa a31dbb5804 2007-11-14 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added ifdef and some modifications to compile without 
BitTorrent,
	Metalink, MessageDigest
	support.
	* src/PieceHashCheckIntegrityEntry.cc
	* src/MetalinkEntry.h
	* src/version_usage.cc
	* src/main.cc
	* src/DownloadEngine.{h, cc}
	* src/Metalink2RequestGroup.cc
	* src/Peer.cc
	* src/RequestGroup.cc
	* src/MetalinkHelper.cc
	* test/DefaultPieceStorageTest.cc
	* test/MetalinkPostDownloadHandlerTest.cc
	* test/Metalink2RequestGroupTest.cc

	Hide TOTAL SPD when all downloads complete.
	* src/ConsoleStatCalc.cc

	Log target system information.
	* src/main.cc
2007-11-14 10:10:38 +00:00

43 lines
1.1 KiB
C++

#include "MetalinkPostDownloadHandler.h"
#include "RequestGroup.h"
#include "Option.h"
#include <cppunit/extensions/HelperMacros.h>
class MetalinkPostDownloadHandlerTest:public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(MetalinkPostDownloadHandlerTest);
CPPUNIT_TEST(testCanHandle);
CPPUNIT_TEST(testGetNextRequestGroups);
CPPUNIT_TEST_SUITE_END();
private:
public:
void setUp() {}
void testCanHandle();
void testGetNextRequestGroups();
};
CPPUNIT_TEST_SUITE_REGISTRATION( MetalinkPostDownloadHandlerTest );
void MetalinkPostDownloadHandlerTest::testCanHandle()
{
Option op;
MetalinkPostDownloadHandler handler(&op);
CPPUNIT_ASSERT(!handler.canHandle(".metalink!!"));
CPPUNIT_ASSERT(handler.canHandle(".metalink"));
}
void MetalinkPostDownloadHandlerTest::testGetNextRequestGroups()
{
Option op;
MetalinkPostDownloadHandler handler(&op);
RequestGroups groups = handler.getNextRequestGroups("test.xml");
#ifdef ENABLE_BITTORRENT
CPPUNIT_ASSERT_EQUAL((size_t)6/* 5 + 1 torrent file download */, groups.size());
#else
CPPUNIT_ASSERT_EQUAL((size_t)5, groups.size());
#endif // ENABLE_BITTORRENT
}