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);
115 assert(apt.validate(ver) == ver);
117 string record = apt.rawRecord(ver);
118 assert(record.find(
"Package: sp") != string::npos);
119 assert(record.find(
"Section: text") != string::npos);
121 record = apt.rawRecord(
Version(
"sp",
"0.31415"));
122 assert_eq(record,
string());
124 assert_eq(apt.rawRecord(pkg), apt.rawRecord(apt.anyVersion(pkg)));
134 s = apt.
state(
"this-package-does-not-really-exists");
135 assert(!s.isValid());
143 i != apt.recordEnd(); ++i)
145 assert((*i).size() > 8);
146 assert_eq((*i).substr(0, 8),
"Package:");
157 i != apt.recordEnd(); ++i)
159 assert(i->size() > 8);
160 assert_eq(i->substr(0, 8),
"Package:");
170 std::copy(apt.begin(), apt.end(), back_inserter(out));
177 std::copy(apt.recordBegin(), apt.recordEnd(), back_inserter(out));
183 assert(apt.isValid(
"apt"));
184 apt.checkCacheUpdates();
185 assert(apt.isValid(
"apt"));
186 apt.invalidateTimestamp();
187 apt.checkCacheUpdates();
188 assert(apt.isValid(
"apt"));
Definition: apt.test.h:28
bool isValid() const
Definition: apt.h:91
Test state()
Definition: apt.test.h:128
Test timestamp()
Definition: apt.test.h:59
Test validity()
Definition: apt.test.h:66
bool isValid() const
Return true if this package contains a valid value.
Definition: version.h:77
Test versionValidity()
Definition: apt.test.h:97
Test iterators()
Definition: apt.test.h:32
High-level access to the Apt cache, as a data provider for the ept framework.
Definition: apt.h:127
Test recordIteration()
Definition: apt.test.h:139
Test stlIteration()
Definition: apt.test.h:167
High-level front-end to libapt-pkg, as a data provider for the ept framework.
Apt apt
Definition: apt.test.h:29
Test checkUpdates()
Definition: apt.test.h:181
Test rawRecord()
Definition: apt.test.h:110
Test stlRecordIteration()
Definition: apt.test.h:174
Test aptExists()
Definition: apt.test.h:45
Test versions()
Definition: apt.test.h:73
bool isInstalled() const
Definition: apt.h:93
unsigned state
Definition: apt.h:70
Lightweight Version class that represent a package with a version, with very cheap value copy operati...
Definition: version.h:40
Test recordIteration2()
Definition: apt.test.h:153