26 using namespace ept::apt;
35 assert(i != apt.end());
38 for (; i != apt.end(); ++i)
49 std::copy(apt.begin(), apt.end(), inserter(packages, packages.begin()));
51 assert(packages.find(
"libsp1") != packages.end());
55 assert(packages.find(
"") == packages.end());
61 time_t ts = apt.timestamp();
68 assert(apt.isValid(
"apt"));
69 assert(!apt.isValid(
"this-package-does-not-really-exists"));
75 std::string pkg(
"apt");
76 Version ver = apt.candidateVersion(pkg);
79 ver = apt.installedVersion(pkg);
80 assert(ver.isValid());
82 ver = apt.anyVersion(pkg);
83 assert(ver.isValid());
85 std::string pkg1(
"this-package-does-not-really-exists");
86 ver = apt.candidateVersion(pkg1);
87 assert(!ver.isValid());
89 ver = apt.installedVersion(pkg1);
90 assert(!ver.isValid());
92 ver = apt.anyVersion(pkg1);
93 assert(!ver.isValid());
99 Version ver = apt.candidateVersion(
"apt");
100 assert(apt.validate(ver) == ver);
102 ver =
Version(
"this-package-does-not-really-exists",
"0.1");
103 assert(!apt.validate(ver).isValid());
105 ver =
Version(
"apt",
"0.31415");
106 assert(!apt.validate(ver).isValid());
113 Version ver = apt.candidateVersion(pkg);
114 assert(apt.validate(ver) == ver);
116 string record = apt.rawRecord(ver);
117 assert(record.find(
"Package: sp") != string::npos);
118 assert(record.find(
"Section: text") != string::npos);
120 record = apt.rawRecord(
Version(
"sp",
"0.31415"));
121 assert_eq(record,
string());
123 assert_eq(apt.rawRecord(pkg), apt.rawRecord(apt.anyVersion(pkg)));
129 PackageState s = apt.state(
"kdenetwork");
131 assert(s.isInstalled());
133 s = apt.state(
"this-package-does-not-really-exists");
134 assert(!s.isValid());
142 i != apt.recordEnd(); ++i)
144 assert((*i).size() > 8);
145 assert_eq((*i).substr(0, 8),
"Package:");
156 i != apt.recordEnd(); ++i)
158 assert(i->size() > 8);
159 assert_eq(i->substr(0, 8),
"Package:");
169 std::copy(apt.begin(), apt.end(), back_inserter(out));
176 std::copy(apt.recordBegin(), apt.recordEnd(), back_inserter(out));
182 assert(apt.isValid(
"apt"));
183 apt.checkCacheUpdates();
184 assert(apt.isValid(
"apt"));
185 apt.invalidateTimestamp();
186 apt.checkCacheUpdates();
187 assert(apt.isValid(
"apt"));
Definition: apt/apt.test.h:28
Test state()
Definition: apt/apt.test.h:127
Test timestamp()
Definition: apt/apt.test.h:59
Test validity()
Definition: apt/apt.test.h:66
bool isValid() const
Return true if this package contains a valid value.
Definition: apt/version.h:77
Test versionValidity()
Definition: apt/apt.test.h:97
Test iterators()
Definition: apt/apt.test.h:32
High-level access to the Apt cache, as a data provider for the ept framework.
Definition: apt/apt.h:60
Test recordIteration()
Definition: apt/apt.test.h:138
High-level front-end to libapt-pkg, as a data provider for the ept framework.
Test stlIteration()
Definition: apt/apt.test.h:166
Apt apt
Definition: apt/apt.test.h:29
Test checkUpdates()
Definition: apt/apt.test.h:180
Test rawRecord()
Definition: apt/apt.test.h:110
Definition: core/apt.h:388
Test stlRecordIteration()
Definition: apt/apt.test.h:173
Test aptExists()
Definition: apt/apt.test.h:45
Test versions()
Definition: apt/apt.test.h:73
Lightweight Version class that represent a package with a version, with very cheap value copy operati...
Definition: apt/version.h:40
Test recordIteration2()
Definition: apt/apt.test.h:152