26 using namespace ept::apt;
37 "Desc: this is the beginning\n"
38 " this is the continuation\n"
47 assert_eq(p.
record(), record);
48 assert_eq(p.
size(), 5u);
54 assert_eq(p.
field(0),
"A:\n");
55 assert_eq(p.
field(1),
"D: da de di do du\n");
56 assert_eq(p.
field(2),
"B: b\n");
57 assert_eq(p.
field(3),
"C: c \n");
58 assert_eq(p.
field(4),
"Desc: this is the beginning\n this is the continuation\n this is the end\n");
64 assert_eq(p.
name(0),
"A");
65 assert_eq(p.
name(1),
"D");
66 assert_eq(p.
name(2),
"B");
67 assert_eq(p.
name(3),
"C");
68 assert_eq(p.
name(4),
"Desc");
75 assert_eq(p[1],
"da de di do du");
78 assert_eq(p[4],
"this is the beginning\n this is the continuation\n this is the end");
86 assert_eq(p.
index(
"A"), 0u);
87 assert_eq(p.
index(
"D"), 1u);
88 assert_eq(p.
index(
"B"), 2u);
89 assert_eq(p.
index(
"C"), 3u);
90 assert_eq(p.
index(
"Desc"), 4u);
96 assert_eq(p.
name(p.
index(
"Desc")),
"Desc");
102 assert_eq(p[
"A"],
"");
103 assert_eq(p[
"B"],
"b");
104 assert_eq(p[
"C"],
"c");
105 assert_eq(p[
"D"],
"da de di do du");
106 assert_eq(p[
"Desc"],
"this is the beginning\n this is the continuation\n this is the end");
109 Test missingBehaviour()
113 assert_eq(p.
field(100),
"");
114 assert_eq(p.
name(100),
"");
115 assert_eq(p[100],
"");
116 assert_eq(p[
"Missing"],
"");
128 assert_eq(p.
size(), 3u);
129 assert_eq(p[
"A"],
"a");
130 assert_eq(p[
"B"],
"b");
131 assert_eq(p[
"C"],
"c");
133 std::string record1 =
142 assert_eq(p.
size(), 2u);
143 assert_eq(p[
"A"],
"different");
144 assert_eq(p[
"B"],
"");
145 assert_eq(p[
"C"],
"");
146 assert_eq(p[
"Foo"],
"bar");
154 "Priority: important\n"
156 "Installed-Size: 4368\n"
157 "Maintainer: APT Development Team <deity@lists.debian.org>\n"
158 "Architecture: amd64\n"
159 "Version: 0.6.46.4-0.1\n"
160 "Replaces: libapt-pkg-doc (<< 0.3.7), libapt-pkg-dev (<< 0.3.7)\n"
161 "Provides: libapt-pkg-libc6.3-6-3.11\n"
162 "Depends: libc6 (>= 2.3.5-1), libgcc1 (>= 1:4.1.1-12), libstdc++6 (>= 4.1.1-12), debian-archive-keyring\n"
163 "Suggests: aptitude | synaptic | gnome-apt | wajig, dpkg-dev, apt-doc, bzip2\n"
164 "Filename: pool/main/a/apt/apt_0.6.46.4-0.1_amd64.deb\n"
166 "MD5sum: 1776421f80d6300c77a608e77a9f4a15\n"
167 "SHA1: 1bd7337d2df56d267632cf72ac930c0a4895898f\n"
168 "SHA256: b92442ab60046b4d0728245f39cc932f26e17db9f7933a5ec9aaa63172f51fda\n"
169 "Description: Advanced front-end for dpkg\n"
170 " This is Debian's next generation front-end for the dpkg package manager.\n"
171 " It provides the apt-get utility and APT dselect method that provides a\n"
172 " simpler, safer way to install and upgrade packages.\n"
174 " APT features complete installation ordering, multiple source capability\n"
175 " and several other unique features, see the Users Guide in apt-doc.\n"
176 "Build-Essential: yes\n"
177 "Tag: admin::package-management, filetransfer::ftp, filetransfer::http, hardware::storage:cd, interface::commandline, network::client, protocol::{ftp,http,ipv6}, role::program, suite::debian, use::downloading, use::searching, works-with::software:package\n";
180 assert_eq(p.
size(), 19u);
183 for (
size_t i = 0; i < p.
size(); ++i)
185 assert_eq(record, rec1);
189 Test bufferTermination()
196 assert_eq(p.
size(), 2u);
197 assert_eq(p[
"A"],
"a");
198 assert_eq(p[
"B"],
"b");
201 Test bufferTermination2()
208 assert_eq(p.
size(), 2u);
209 assert_eq(p[
"A"],
"a");
210 assert_eq(p[
"B"],
"b");
213 Test bufferTermination3()
221 assert_eq(p.
size(), 2u);
222 assert_eq(p[
"A"],
"a");
223 assert_eq(p[
"B"],
"b");