]> git.saurik.com Git - apt.git/blob - test/libapt/getarchitectures_test.cc
* apt-pkg/aptconfiguration.cc:
[apt.git] / test / libapt / getarchitectures_test.cc
1 #include <apt-pkg/aptconfiguration.h>
2 #include <apt-pkg/configuration.h>
3
4 #include "assert.h"
5 #include <string>
6 #include <vector>
7
8 #include <iostream>
9
10 int main(int argc,char *argv[])
11 {
12 std::vector<std::string> vec;
13
14 _config->Set("APT::Architectures::1", "i386");
15 _config->Set("APT::Architectures::2", "amd64");
16 vec = APT::Configuration::getArchitectures(false);
17 equals(vec.size(), 2);
18 equals(vec[0], "i386");
19 equals(vec[1], "amd64");
20
21 _config->Set("APT::Architecture", "i386");
22 vec = APT::Configuration::getArchitectures(false);
23 equals(vec.size(), 2);
24 equals(vec[0], "i386");
25 equals(vec[1], "amd64");
26
27 _config->Set("APT::Architectures::2", "");
28 vec = APT::Configuration::getArchitectures(false);
29 equals(vec.size(), 1);
30 equals(vec[0], "i386");
31
32 _config->Set("APT::Architecture", "armel");
33 vec = APT::Configuration::getArchitectures(false);
34 equals(vec.size(), 2);
35 equals(vec[0], "armel");
36 equals(vec[1], "i386");
37
38 _config->Set("APT::Architectures::2", "armel");
39 vec = APT::Configuration::getArchitectures(false);
40 equals(vec.size(), 2);
41 equals(vec[0], "i386");
42 equals(vec[1], "armel");
43
44 _config->Set("APT::Architectures::2", "amd64");
45 _config->Set("APT::Architectures::3", "i386");
46 _config->Set("APT::Architectures::4", "armel");
47 _config->Set("APT::Architectures::5", "i386");
48 _config->Set("APT::Architectures::6", "amd64");
49 _config->Set("APT::Architectures::7", "armel");
50 _config->Set("APT::Architectures::8", "armel");
51 _config->Set("APT::Architectures::9", "amd64");
52 _config->Set("APT::Architectures::10", "amd64");
53 vec = APT::Configuration::getArchitectures(false);
54 equals(vec.size(), 3);
55 equals(vec[0], "i386");
56 equals(vec[1], "amd64");
57 equals(vec[2], "armel");
58
59 return 0;
60 }