]> git.saurik.com Git - apt.git/blob - test/libapt/cachefilter_test.cc
warn if apt-key is used in scripts/its output parsed
[apt.git] / test / libapt / cachefilter_test.cc
1 #include <config.h>
2
3 #include <apt-pkg/cachefilter.h>
4
5 #include <string>
6
7 #include <gtest/gtest.h>
8
9 TEST(CacheFilterTest, ArchitectureSpecification)
10 {
11 {
12 SCOPED_TRACE("Pattern is any-armhf");
13 APT::CacheFilter::PackageArchitectureMatchesSpecification ams("any-armhf");
14 EXPECT_TRUE(ams("armhf"));
15 EXPECT_FALSE(ams("armel"));
16 EXPECT_TRUE(ams("linux-armhf"));
17 EXPECT_FALSE(ams("linux-armel"));
18 EXPECT_TRUE(ams("kfreebsd-armhf"));
19 EXPECT_TRUE(ams("gnu-linux-armhf"));
20 EXPECT_FALSE(ams("gnu-linux-armel"));
21 EXPECT_TRUE(ams("gnu-kfreebsd-armhf"));
22 EXPECT_TRUE(ams("musl-linux-armhf"));
23 }
24 {
25 SCOPED_TRACE("Pattern is linux-any");
26 APT::CacheFilter::PackageArchitectureMatchesSpecification ams("linux-any");
27 EXPECT_TRUE(ams("armhf"));
28 EXPECT_TRUE(ams("armel"));
29 EXPECT_TRUE(ams("linux-armhf"));
30 EXPECT_TRUE(ams("linux-armel"));
31 EXPECT_FALSE(ams("kfreebsd-armhf"));
32 EXPECT_TRUE(ams("gnu-linux-armhf"));
33 EXPECT_TRUE(ams("gnu-linux-armel"));
34 EXPECT_FALSE(ams("gnu-kfreebsd-armhf"));
35 EXPECT_TRUE(ams("musl-linux-armhf"));
36 }
37 {
38 SCOPED_TRACE("Pattern is gnu-any-any");
39 APT::CacheFilter::PackageArchitectureMatchesSpecification ams("gnu-any-any"); //really?
40 EXPECT_TRUE(ams("armhf"));
41 EXPECT_TRUE(ams("armel"));
42 EXPECT_TRUE(ams("linux-armhf"));
43 EXPECT_TRUE(ams("linux-armel"));
44 EXPECT_TRUE(ams("kfreebsd-armhf"));
45 EXPECT_TRUE(ams("gnu-linux-armhf"));
46 EXPECT_TRUE(ams("gnu-linux-armel"));
47 EXPECT_TRUE(ams("gnu-kfreebsd-armhf"));
48 EXPECT_FALSE(ams("musl-linux-armhf"));
49 }
50 {
51 SCOPED_TRACE("Architecture is armhf");
52 APT::CacheFilter::PackageArchitectureMatchesSpecification ams("armhf", false);
53 EXPECT_TRUE(ams("armhf"));
54 EXPECT_FALSE(ams("armel"));
55 EXPECT_TRUE(ams("linux-any"));
56 EXPECT_FALSE(ams("kfreebsd-any"));
57 EXPECT_TRUE(ams("any-armhf"));
58 EXPECT_FALSE(ams("any-armel"));
59 EXPECT_TRUE(ams("linux-armhf"));
60 EXPECT_FALSE(ams("kfreebsd-armhf"));
61 EXPECT_TRUE(ams("gnu-linux-armhf"));
62 EXPECT_FALSE(ams("gnu-linux-armel"));
63 EXPECT_FALSE(ams("gnu-kfreebsd-armhf"));
64 EXPECT_FALSE(ams("musl-linux-armhf"));
65 }
66 }