mirror of
https://github.com/aria2/aria2.git
synced 2025-02-26 08:22:11 +00:00
RequestGroup::getNextCommand() was renamed to createNextCommand(). Added its overloaded method. * src/RequestGroup.h (_numConcurrentCommand): New variable. (setNumConcurrentCommand): New function. * src/RequestGroup.cc Abort download if same file is being downloaded concurrently. * src/RequestGroup.h, src/RequestGroupMan.cc (isSameFileBeingDownloaded): New function. * src/HttpResponseCommand.cc (executeInternal) * src/FtpNegotiateCommand.cc (recvSize) * src/message.h (EX_DUPLICATE_FILE_DOWNLOAD): New definition. * main.cc: Added help message for -i option.
48 lines
1.1 KiB
C++
48 lines
1.1 KiB
C++
#include "RequestGroupMan.h"
|
|
#include <cppunit/extensions/HelperMacros.h>
|
|
|
|
using namespace std;
|
|
|
|
class RequestGroupManTest : public CppUnit::TestFixture {
|
|
|
|
CPPUNIT_TEST_SUITE(RequestGroupManTest);
|
|
CPPUNIT_TEST(testIsSameFileBeingDownloaded);
|
|
CPPUNIT_TEST_SUITE_END();
|
|
private:
|
|
|
|
public:
|
|
void setUp() {}
|
|
|
|
void testIsSameFileBeingDownloaded();
|
|
};
|
|
|
|
|
|
CPPUNIT_TEST_SUITE_REGISTRATION( RequestGroupManTest );
|
|
|
|
void RequestGroupManTest::testIsSameFileBeingDownloaded()
|
|
{
|
|
Option option;
|
|
RequestGroupMan gm;
|
|
|
|
RequestGroupHandle rg1 = new RequestGroup("http://localhost/aria2.tar.bz2",
|
|
&option);
|
|
RequestGroupHandle rg2 = new RequestGroup("http://localhost/aria2.tar.bz2",
|
|
&option);
|
|
|
|
gm.addRequestGroup(rg1);
|
|
gm.addRequestGroup(rg2);
|
|
|
|
rg1->initSegmentMan();
|
|
rg2->initSegmentMan();
|
|
|
|
rg1->getSegmentMan()->filename = "aria2.tar.bz2";
|
|
rg2->getSegmentMan()->filename = "aria2.tar.bz2";
|
|
|
|
CPPUNIT_ASSERT(gm.isSameFileBeingDownloaded(rg1.get()));
|
|
|
|
rg2->getSegmentMan()->filename = "aria2-0.10.2.tar.bz2";
|
|
|
|
CPPUNIT_ASSERT(!gm.isSameFileBeingDownloaded(rg1.get()));
|
|
|
|
}
|