]> git.saurik.com Git - apt.git/blob - test/libapt/getarchitectures_test.cc
$! doesn't worked on the first try somehow, now it does and its
[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 // 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();
13 v != vec.end(); v++)
14 std::cout << *v << std::endl;
15 }
16
17 int main(int argc,char *argv[])
18 {
19 std::vector<std::string> vec;
20
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");
27
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");
33
34 _config->Set("APT::Architectures::2", "");
35 vec = APT::Configuration::getArchitectures(false);
36 equals(vec.size(), 1);
37 equals(vec[0], "i386");
38
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");
44
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");
59
60 return 0;
61 }