cleanup headers and especially #includes everywhere
[ntk/apt.git] / test / libapt / cdromreducesourcelist_test.cc
1 #include <config.h>
2
3 #include <apt-pkg/cdrom.h>
4
5 #include <string>
6 #include <vector>
7
8 #include "assert.h"
9
10 class Cdrom : public pkgCdrom {
11 public:
12 std::vector<std::string> ReduceSourcelist(std::string CD,std::vector<std::string> List) {
13 pkgCdrom::ReduceSourcelist(CD, List);
14 return List;
15 }
16 };
17
18 int main() {
19 Cdrom cd;
20 std::vector<std::string> List;
21 std::string CD("/media/cdrom/");
22
23 std::vector<std::string> R = cd.ReduceSourcelist(CD, List);
24 equals(R.empty(), true);
25
26 List.push_back(" wheezy main");
27 R = cd.ReduceSourcelist(CD, List);
28 equals(R.size(), 1);
29 equals(R[0], " wheezy main");
30
31 List.push_back(" wheezy main");
32 R = cd.ReduceSourcelist(CD, List);
33 equals(R.size(), 1);
34 equals(R[0], " wheezy main");
35
36 List.push_back(" wheezy contrib");
37 R = cd.ReduceSourcelist(CD, List);
38 equals(R.size(), 1);
39 equals(R[0], " wheezy contrib main");
40
41 List.push_back(" wheezy-update contrib");
42 R = cd.ReduceSourcelist(CD, List);
43 equals(R.size(), 2);
44 equals(R[0], " wheezy contrib main");
45 equals(R[1], " wheezy-update contrib");
46
47 List.push_back(" wheezy-update contrib");
48 R = cd.ReduceSourcelist(CD, List);
49 equals(R.size(), 2);
50 equals(R[0], " wheezy contrib main");
51 equals(R[1], " wheezy-update contrib");
52
53 List.push_back(" wheezy-update non-free");
54 R = cd.ReduceSourcelist(CD, List);
55 equals(R.size(), 2);
56 equals(R[0], " wheezy contrib main");
57 equals(R[1], " wheezy-update contrib non-free");
58
59 List.push_back(" wheezy-update main");
60 R = cd.ReduceSourcelist(CD, List);
61 equals(R.size(), 2);
62 equals(R[0], " wheezy contrib main");
63 equals(R[1], " wheezy-update contrib main non-free");
64
65 List.push_back(" wheezy non-free");
66 R = cd.ReduceSourcelist(CD, List);
67 equals(R.size(), 2);
68 equals(R[0], " wheezy contrib main non-free");
69 equals(R[1], " wheezy-update contrib main non-free");
70
71 List.push_back(" sid main");
72 R = cd.ReduceSourcelist(CD, List);
73 equals(R.size(), 3);
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");
77
78 List.push_back(" sid main-reduce");
79 R = cd.ReduceSourcelist(CD, List);
80 equals(R.size(), 3);
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");
84
85 return 0;
86 }