You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

67 lines
2.2 KiB

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