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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
#include <config.h>
#include <apt-pkg/cdrom.h>
#include <string>
#include <vector>
#include "assert.h"
class Cdrom : public pkgCdrom {
public:
std::vector<std::string> ReduceSourcelist(std::string CD,std::vector<std::string> List) {
pkgCdrom::ReduceSourcelist(CD, List);
return List;
}
};
int main() {
Cdrom cd;
std::vector<std::string> List;
std::string CD("/media/cdrom/");
std::vector<std::string> R = cd.ReduceSourcelist(CD, List);
equals(R.empty(), true);
List.push_back(" wheezy main");
R = cd.ReduceSourcelist(CD, List);
equals(R.size(), 1);
equals(R[0], " wheezy main");
List.push_back(" wheezy main");
R = cd.ReduceSourcelist(CD, List);
equals(R.size(), 1);
equals(R[0], " wheezy main");
List.push_back(" wheezy contrib");
R = cd.ReduceSourcelist(CD, List);
equals(R.size(), 1);
equals(R[0], " wheezy contrib main");
List.push_back(" wheezy-update contrib");
R = cd.ReduceSourcelist(CD, List);
equals(R.size(), 2);
equals(R[0], " wheezy contrib main");
equals(R[1], " wheezy-update contrib");
List.push_back(" wheezy-update contrib");
R = cd.ReduceSourcelist(CD, List);
equals(R.size(), 2);
equals(R[0], " wheezy contrib main");
equals(R[1], " wheezy-update contrib");
List.push_back(" wheezy-update non-free");
R = cd.ReduceSourcelist(CD, List);
equals(R.size(), 2);
equals(R[0], " wheezy contrib main");
equals(R[1], " wheezy-update contrib non-free");
List.push_back(" wheezy-update main");
R = cd.ReduceSourcelist(CD, List);
equals(R.size(), 2);
equals(R[0], " wheezy contrib main");
equals(R[1], " wheezy-update contrib main non-free");
List.push_back(" wheezy non-free");
R = cd.ReduceSourcelist(CD, List);
equals(R.size(), 2);
equals(R[0], " wheezy contrib main non-free");
equals(R[1], " wheezy-update contrib main non-free");
List.push_back(" sid main");
R = cd.ReduceSourcelist(CD, List);
equals(R.size(), 3);
equals(R[0], " sid main");
equals(R[1], " wheezy contrib main non-free");
equals(R[2], " wheezy-update contrib main non-free");
List.push_back(" sid main-reduce");
R = cd.ReduceSourcelist(CD, List);
equals(R.size(), 3);
equals(R[0], " sid main main-reduce");
equals(R[1], " wheezy contrib main non-free");
equals(R[2], " wheezy-update contrib main non-free");
return 0;
}
|