]>
git.saurik.com Git - apt.git/blob - test/libapt/getarchitectures_test.cc
1 #include <apt-pkg/aptconfiguration.h>
2 #include <apt-pkg/configuration.h>
10 // simple helper to quickly output a vector of strings
11 void dumpVector(std::vector
<std::string
> vec
) {
12 for (std::vector
<std::string
>::const_iterator v
= vec
.begin();
14 std::cout
<< *v
<< std::endl
;
17 int main(int argc
,char *argv
[])
19 std::vector
<std::string
> vec
;
21 _config
->Set("APT::Architectures::1", "i386");
22 _config
->Set("APT::Architectures::2", "amd64");
23 vec
= APT::Configuration::getArchitectures(false);
24 equals(vec
.size(), 2);
25 equals(vec
[0], "i386");
26 equals(vec
[1], "amd64");
28 _config
->Set("APT::Architecture", "i386");
29 vec
= APT::Configuration::getArchitectures(false);
30 equals(vec
.size(), 2);
31 equals(vec
[0], "i386");
32 equals(vec
[1], "amd64");
34 _config
->Set("APT::Architectures::2", "");
35 vec
= APT::Configuration::getArchitectures(false);
36 equals(vec
.size(), 1);
37 equals(vec
[0], "i386");
39 _config
->Set("APT::Architecture", "armel");
40 vec
= APT::Configuration::getArchitectures(false);
41 equals(vec
.size(), 2);
42 equals(vec
[0], "i386");
43 equals(vec
[1], "armel");
45 _config
->Set("APT::Architectures::2", "amd64");
46 _config
->Set("APT::Architectures::3", "i386");
47 _config
->Set("APT::Architectures::4", "armel");
48 _config
->Set("APT::Architectures::5", "i386");
49 _config
->Set("APT::Architectures::6", "amd64");
50 _config
->Set("APT::Architectures::7", "armel");
51 _config
->Set("APT::Architectures::8", "armel");
52 _config
->Set("APT::Architectures::9", "amd64");
53 _config
->Set("APT::Architectures::10", "amd64");
54 vec
= APT::Configuration::getArchitectures(false);
55 equals(vec
.size(), 3);
56 equals(vec
[0], "i386");
57 equals(vec
[1], "amd64");
58 equals(vec
[2], "armel");