]>
git.saurik.com Git - apt.git/blob - test/libapt/getarchitectures_test.cc
3 #include <apt-pkg/aptconfiguration.h>
4 #include <apt-pkg/configuration.h>
9 #include <gtest/gtest.h>
11 TEST(ArchitecturesTest
,SimpleLists
)
14 std::vector
<std::string
> vec
;
16 _config
->Set("APT::Architectures::1", "i386");
17 _config
->Set("APT::Architectures::2", "amd64");
18 vec
= APT::Configuration::getArchitectures(false);
19 ASSERT_EQ(2, vec
.size());
20 EXPECT_EQ("i386", vec
[0]);
21 EXPECT_EQ("amd64", vec
[1]);
23 _config
->Set("APT::Architecture", "i386");
24 vec
= APT::Configuration::getArchitectures(false);
25 ASSERT_EQ(2, vec
.size());
26 EXPECT_EQ("i386", vec
[0]);
27 EXPECT_EQ("amd64", vec
[1]);
29 _config
->Set("APT::Architectures::2", "");
30 vec
= APT::Configuration::getArchitectures(false);
31 ASSERT_EQ(1, vec
.size());
32 EXPECT_EQ("i386", vec
[0]);
34 _config
->Set("APT::Architecture", "armel");
35 vec
= APT::Configuration::getArchitectures(false);
36 ASSERT_EQ(2, vec
.size());
37 EXPECT_EQ("armel", vec
[0]);
38 EXPECT_EQ("i386", vec
[1]);
40 _config
->Set("APT::Architectures::2", "armel");
41 vec
= APT::Configuration::getArchitectures(false);
42 ASSERT_EQ(2, vec
.size());
43 EXPECT_EQ("i386", vec
[0]);
44 EXPECT_EQ("armel", vec
[1]);
46 _config
->Set("APT::Architectures", "armel,armhf");
47 vec
= APT::Configuration::getArchitectures(false);
48 ASSERT_EQ(2, vec
.size());
49 EXPECT_EQ("armel", vec
[0]);
50 EXPECT_EQ("armhf", vec
[1]);
53 TEST(ArchitecturesTest
,Duplicates
)
57 _config
->Set("APT::Architecture", "armel");
58 _config
->Set("APT::Architectures::", "i386");
59 _config
->Set("APT::Architectures::", "amd64");
60 _config
->Set("APT::Architectures::", "i386");
61 _config
->Set("APT::Architectures::", "armel");
62 _config
->Set("APT::Architectures::", "i386");
63 _config
->Set("APT::Architectures::", "amd64");
64 _config
->Set("APT::Architectures::", "armel");
65 _config
->Set("APT::Architectures::", "armel");
66 _config
->Set("APT::Architectures::", "amd64");
67 _config
->Set("APT::Architectures::", "amd64");
68 std::vector
<std::string
> vec
= _config
->FindVector("APT::Architectures");
69 ASSERT_EQ(10, vec
.size());
70 vec
= APT::Configuration::getArchitectures(false);
71 ASSERT_EQ(3, vec
.size());
72 EXPECT_EQ("i386", vec
[0]);
73 EXPECT_EQ("amd64", vec
[1]);
74 EXPECT_EQ("armel", vec
[2]);