]>
git.saurik.com Git - apt.git/blob - test/libapt/cdromreducesourcelist_test.cc
1 #include <apt-pkg/cdrom.h>
2 #include <apt-pkg/error.h>
10 class Cdrom
: public pkgCdrom
{
12 std::vector
<std::string
> ReduceSourcelist(std::string CD
,std::vector
<std::string
> List
) {
13 pkgCdrom::ReduceSourcelist(CD
, List
);
18 int main(int argc
, char const *argv
[]) {
20 std::vector
<std::string
> List
;
21 std::string
CD("/media/cdrom/");
23 std::vector
<std::string
> R
= cd
.ReduceSourcelist(CD
, List
);
24 equals(R
.empty(), true);
26 List
.push_back(" wheezy main");
27 R
= cd
.ReduceSourcelist(CD
, List
);
29 equals(R
[0], " wheezy main");
31 List
.push_back(" wheezy main");
32 R
= cd
.ReduceSourcelist(CD
, List
);
34 equals(R
[0], " wheezy main");
36 List
.push_back(" wheezy contrib");
37 R
= cd
.ReduceSourcelist(CD
, List
);
39 equals(R
[0], " wheezy contrib main");
41 List
.push_back(" wheezy-update contrib");
42 R
= cd
.ReduceSourcelist(CD
, List
);
44 equals(R
[0], " wheezy contrib main");
45 equals(R
[1], " wheezy-update contrib");
47 List
.push_back(" wheezy-update contrib");
48 R
= cd
.ReduceSourcelist(CD
, List
);
50 equals(R
[0], " wheezy contrib main");
51 equals(R
[1], " wheezy-update contrib");
53 List
.push_back(" wheezy-update non-free");
54 R
= cd
.ReduceSourcelist(CD
, List
);
56 equals(R
[0], " wheezy contrib main");
57 equals(R
[1], " wheezy-update contrib non-free");
59 List
.push_back(" wheezy-update main");
60 R
= cd
.ReduceSourcelist(CD
, List
);
62 equals(R
[0], " wheezy contrib main");
63 equals(R
[1], " wheezy-update contrib main non-free");
65 List
.push_back(" wheezy non-free");
66 R
= cd
.ReduceSourcelist(CD
, List
);
68 equals(R
[0], " wheezy contrib main non-free");
69 equals(R
[1], " wheezy-update contrib main non-free");
71 List
.push_back(" sid main");
72 R
= cd
.ReduceSourcelist(CD
, List
);
74 equals(R
[0], " sid main");
75 equals(R
[1], " wheezy contrib main non-free");
76 equals(R
[2], " wheezy-update contrib main non-free");
78 List
.push_back(" sid main-reduce");
79 R
= cd
.ReduceSourcelist(CD
, List
);
81 equals(R
[0], " sid main main-reduce");
82 equals(R
[1], " wheezy contrib main non-free");
83 equals(R
[2], " wheezy-update contrib main non-free");