blob: ef7eb70761ad0d3e9dac2c25f6638c97b8617c41 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
#include "RequestGroupMan.h"
#include "CUIDCounter.h"
#include "prefs.h"
#include "SingleFileDownloadContext.h"
#include "RequestGroup.h"
#include "Option.h"
#include "DownloadResult.h"
#include <cppunit/extensions/HelperMacros.h>
using namespace std;
class RequestGroupManTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(RequestGroupManTest);
CPPUNIT_TEST(testIsSameFileBeingDownloaded);
CPPUNIT_TEST(testGetInitialCommands);
CPPUNIT_TEST_SUITE_END();
private:
public:
void setUp()
{
CUIDCounterHandle counter = new CUIDCounter();
CUIDCounterSingletonHolder::instance(counter);
}
void testIsSameFileBeingDownloaded();
void testGetInitialCommands();
};
CPPUNIT_TEST_SUITE_REGISTRATION( RequestGroupManTest );
void RequestGroupManTest::testIsSameFileBeingDownloaded()
{
Option option;
Strings uris;
uris.push_back("http://localhost/aria2.tar.bz2");
RequestGroupHandle rg1 = new RequestGroup(&option, uris);
RequestGroupHandle rg2 = new RequestGroup(&option, uris);
SingleFileDownloadContextHandle dctx1 =
new SingleFileDownloadContext(0, 0, "aria2.tar.bz2");
SingleFileDownloadContextHandle dctx2 =
new SingleFileDownloadContext(0, 0, "aria2.tar.bz2");
rg1->setDownloadContext(dctx1);
rg2->setDownloadContext(dctx2);
RequestGroups rgs;
rgs.push_back(rg1);
rgs.push_back(rg2);
RequestGroupMan gm(rgs, 1);
CPPUNIT_ASSERT(gm.isSameFileBeingDownloaded(rg1.get()));
dctx2->setFilename("aria2.tar.gz");
CPPUNIT_ASSERT(!gm.isSameFileBeingDownloaded(rg1.get()));
}
void RequestGroupManTest::testGetInitialCommands()
{
// TODO implement later
}
|