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());
69 assert(!apt.
isValid(
"this-package-does-not-really-exists"));
75 std::string pkg(
"apt");
80 assert(ver.isValid());
83 assert(ver.isValid());
85 std::string pkg1(
"this-package-does-not-really-exists");
87 assert(!ver.isValid());
90 assert(!ver.isValid());
93 assert(!ver.isValid());
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());
117 assert(record.find(
"Package: sp") != string::npos);
118 assert(record.find(
"Section: text") != string::npos);
121 assert_eq(record,
string());
129 PackageState s = apt.
state(
"kdenetwork");
131 assert(s.isInstalled());
133 s = apt.
state(
"this-package-does-not-really-exists");
134 assert(!s.isValid());
144 assert((*i).size() > 8);
145 assert_eq((*i).substr(0, 8),
"Package:");
158 assert(i->size() > 8);
159 assert_eq(i->substr(0, 8),
"Package:");
169 std::copy(apt.
begin(), apt.
end(), back_inserter(out));
Definition: apt/apt.test.h:28
Test state()
Definition: apt/apt.test.h:127
void checkCacheUpdates()
Check if the cache has been changed by another process, and reopen it if that is the case...
Definition: apt.cc:622
record_iterator recordBegin() const
Definition: apt.cc:448
Test timestamp()
Definition: apt/apt.test.h:59
Test validity()
Definition: apt/apt.test.h:66
Definition: packagerecord.test.h:22
-*- C++ -*- (c) 2006, 2007 Petr Rockai me@mornfall.net
Definition: apt.cc:43
PackageState state(const std::string &pkg) const
Return state information on a package.
Definition: apt.cc:522
bool isValid(const std::string &pkg) const
Validate a package name, returning trye if it exists in the APT database, or false if it does not...
Definition: apt.cc:468
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
std::string validate(const std::string &pkg) const
Validate a package name, returning it if it exists in the APT database, or returning the empty string...
Definition: apt/apt.h:154
Test iterators()
Definition: apt/apt.test.h:32
Version installedVersion(const std::string &pkg) const
Return the installed version for a package.
Definition: apt.cc:497
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
time_t timestamp()
Timestamp of when the apt index was last modified.
Definition: apt.cc:463
iterator end() const
Definition: apt.cc:443
High-level front-end to libapt-pkg, as a data provider for the ept framework.
Test stlIteration()
Definition: apt/apt.test.h:166
Version candidateVersion(const std::string &pkg) const
Return the candidate version for a package.
Definition: apt.cc:488
void invalidateTimestamp()
Invalidate the cache timestamp used to track cache updates.
Definition: apt.cc:632
iterator begin() const
Definition: apt.cc:436
record_iterator recordEnd() const
Definition: apt.cc:453
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
std::string rawRecord(const std::string &pkg) const
Perform a package search.
Definition: apt.cc:569
Test aptExists()
Definition: apt/apt.test.h:45
Test versions()
Definition: apt/apt.test.h:73
Version anyVersion(const std::string &pkg) const
Return the candidate version for a package, if available, or the installed version otherwise...
Definition: apt.cc:507
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