Lines Matching defs:pd
17 PuffData pd;
22 pd.type = PuffData::Type::kBlockMetadata;
23 pd.length = 1;
24 ASSERT_TRUE(pw.Insert(pd, &error));
27 ASSERT_TRUE(pr.GetNext(&pd, &error));
28 ASSERT_EQ(pd.type, PuffData::Type::kBlockMetadata);
29 ASSERT_EQ(pd.length, 1);
32 pd.type = PuffData::Type::kLiterals;
33 pd.length = length;
34 pd.read_fn = [](uint8_t* buffer, size_t count) {
38 ASSERT_TRUE(pw.Insert(pd, &error));
41 pd.type = PuffData::Type::kLenDist;
42 pd.distance = 1;
43 pd.length = 3;
44 ASSERT_TRUE(pw.Insert(pd, &error));
46 ASSERT_TRUE(pr.GetNext(&pd, &error));
49 ASSERT_EQ(pd.type, PuffData::Type::kLenDist);
52 ASSERT_EQ(pd.type, PuffData::Type::kLiterals);
53 ASSERT_EQ(pd.length, length);
54 for (size_t i = 0; i < pd.length; i++) {
56 pd.read_fn(&byte, 1);
73 PuffData pd;
74 pd.type = PuffData::Type::kBlockMetadata;
75 pd.block_metadata[0] = 0xCC; // header
76 memcpy(&pd.block_metadata[1], &block, sizeof(block));
77 pd.length = sizeof(block) + 1;
78 ASSERT_TRUE(pw.Insert(pd, &error));
79 ASSERT_TRUE(epw.Insert(pd, &error));
84 PuffData pd;
85 ASSERT_TRUE(pr.GetNext(&pd, &error));
86 ASSERT_EQ(pd.type, PuffData::Type::kBlockMetadata);
87 ASSERT_EQ(pd.length, sizeof(block) + 1);
88 ASSERT_EQ(pd.block_metadata[0], 0xCC);
89 ASSERT_EQ(pd.block_metadata[1], block);
92 PuffData pd;
93 pd.type = PuffData::Type::kLenDist;
94 pd.distance = 321;
95 pd.length = 3;
96 ASSERT_TRUE(pw.Insert(pd, &error));
97 ASSERT_TRUE(epw.Insert(pd, &error));
98 pd.length = 127;
99 ASSERT_TRUE(pw.Insert(pd, &error));
100 ASSERT_TRUE(epw.Insert(pd, &error));
101 pd.length = 258;
102 ASSERT_TRUE(pw.Insert(pd, &error));
103 ASSERT_TRUE(epw.Insert(pd, &error));
107 pd.length = 259;
108 ASSERT_FALSE(pw.Insert(pd, &error));
109 ASSERT_FALSE(epw.Insert(pd, &error));
112 PuffData pd;
113 ASSERT_TRUE(pr.GetNext(&pd, &error));
114 ASSERT_EQ(pd.type, PuffData::Type::kLenDist);
115 ASSERT_EQ(pd.distance, 321);
116 ASSERT_EQ(pd.length, 3);
117 ASSERT_TRUE(pr.GetNext(&pd, &error));
118 ASSERT_EQ(pd.type, PuffData::Type::kLenDist);
119 ASSERT_EQ(pd.length, 127);
120 ASSERT_TRUE(pr.GetNext(&pd, &error));
121 ASSERT_EQ(pd.type, PuffData::Type::kLenDist);
122 ASSERT_EQ(pd.length, 258);
125 PuffData pd;
126 pd.type = PuffData::Type::kEndOfBlock;
127 ASSERT_TRUE(pw.Insert(pd, &error));
128 ASSERT_TRUE(epw.Insert(pd, &error));
133 PuffData pd;
134 ASSERT_TRUE(pr.GetNext(&pd, &error));
135 ASSERT_EQ(pd.type, PuffData::Type::kEndOfBlock);
138 PuffData pd;
139 pd.type = PuffData::Type::kBlockMetadata;
141 pd.block_metadata[0] = 0xCC; // header
142 memcpy(&pd.block_metadata[1], &block, sizeof(block));
143 pd.length = sizeof(block) + 1;
144 ASSERT_TRUE(pw.Insert(pd, &error));
145 ASSERT_TRUE(epw.Insert(pd, &error));
150 PuffData pd;
151 ASSERT_TRUE(pr.GetNext(&pd, &error));
152 ASSERT_EQ(pd.type, PuffData::Type::kBlockMetadata);
153 ASSERT_EQ(pd.length, sizeof(block) + 1);
154 ASSERT_EQ(pd.block_metadata[0], 0xCC);
155 ASSERT_EQ(pd.block_metadata[1], block);
160 PuffData pd;
162 pd.type = PuffData::Type::kLiterals;
163 pd.length = 3;
164 pd.read_fn = [&tmp, &index](uint8_t* buffer, size_t count) {
173 ASSERT_TRUE(pw.Insert(pd, &error));
177 ASSERT_TRUE(epw.Insert(pd, &error));
181 PuffData pd;
182 pd.type = PuffData::Type::kLiteral;
183 pd.byte = 10;
184 ASSERT_TRUE(pw.Insert(pd, &error));
185 ASSERT_TRUE(epw.Insert(pd, &error));
192 PuffData pd;
193 ASSERT_TRUE(pr.GetNext(&pd, &error));
194 ASSERT_EQ(pd.type, PuffData::Type::kLiterals);
195 ASSERT_EQ(pd.length, 3);
196 ASSERT_TRUE(pd.read_fn(tmp3, 3));
197 ASSERT_FALSE(pd.read_fn(tmp3, 1));
201 PuffData pd;
202 ASSERT_TRUE(pr.GetNext(&pd, &error));
203 ASSERT_EQ(pd.type, PuffData::Type::kLiterals);
204 ASSERT_EQ(pd.length, 1);
205 ASSERT_TRUE(pd.read_fn(tmp3, 1));
207 ASSERT_FALSE(pd.read_fn(tmp3, 2));
210 PuffData pd;
211 pd.type = PuffData::Type::kEndOfBlock;
212 ASSERT_TRUE(pw.Insert(pd, &error));
213 ASSERT_TRUE(epw.Insert(pd, &error));
218 PuffData pd;
219 ASSERT_TRUE(pr.GetNext(&pd, &error));
220 ASSERT_EQ(pd.type, PuffData::Type::kEndOfBlock);
229 PuffData pd;
236 pd.type = PuffData::Type::kBlockMetadata;
237 pd.length = 2;
238 ASSERT_FALSE(pw.Insert(pd, &error));
240 pd.length = 0; // length should be at least 1.
241 ASSERT_FALSE(pw.Insert(pd, &error));
242 pd.length = 1;
243 ASSERT_TRUE(pw.Insert(pd, &error));
247 ASSERT_FALSE(pr.GetNext(&pd, &error));
251 PuffData pd;
257 pd.type = PuffData::Type::kLenDist;
258 pd.distance = 1;
259 pd.length = 0;
260 EXPECT_FALSE(pw.Insert(pd, &error));
261 pd.length = 1;
262 EXPECT_FALSE(pw.Insert(pd, &error));
263 pd.length = 2;
264 EXPECT_FALSE(pw.Insert(pd, &error));
265 pd.length = 3;
266 EXPECT_TRUE(pw.Insert(pd, &error));
267 pd.length = 259;
268 EXPECT_FALSE(pw.Insert(pd, &error));
269 pd.length = 258;
270 EXPECT_TRUE(pw.Insert(pd, &error));
273 pd.length = 3;
274 pd.distance = 0;
275 EXPECT_FALSE(pw.Insert(pd, &error));
276 pd.distance = 1;
277 EXPECT_TRUE(pw.Insert(pd, &error));
278 pd.distance = 32769;
279 EXPECT_FALSE(pw.Insert(pd, &error));
280 pd.distance = 32768;
281 EXPECT_TRUE(pw.Insert(pd, &error));
288 EXPECT_TRUE(pr.GetNext(&pd, &error));
289 EXPECT_EQ(pd.type, PuffData::Type::kBlockMetadata);
290 EXPECT_TRUE(pr.GetNext(&pd, &error));
291 EXPECT_EQ(pd.type, PuffData::Type::kLenDist);
292 EXPECT_FALSE(pr.GetNext(&pd, &error));
296 PuffData pd;
300 pd.type = PuffData::Type::kLenDist;
301 pd.distance = 1;
302 pd.length = 129;
305 EXPECT_FALSE(pw.Insert(pd, &error));
308 pd.length = 130;
311 EXPECT_FALSE(pw.Insert(pd, &error));
317 EXPECT_TRUE(pr.GetNext(&pd, &error));
318 EXPECT_EQ(pd.type, PuffData::Type::kBlockMetadata);
319 EXPECT_FALSE(pr.GetNext(&pd, &error));
334 PuffData pd;
339 pd.type = PuffData::Type::kBlockMetadata;
340 pd.length = 1;
341 ASSERT_TRUE(pw.Insert(pd, &error));
343 pd.type = PuffData::Type::kLiterals;
344 pd.length = (1 << 16);
345 pd.read_fn = [](uint8_t* buffer, size_t count) {
349 ASSERT_TRUE(pw.Insert(pd, &error));
353 ASSERT_TRUE(pr.GetNext(&pd, &error));
354 ASSERT_EQ(pd.type, PuffData::Type::kBlockMetadata);
355 ASSERT_EQ(pd.length, 1);
357 ASSERT_TRUE(pr.GetNext(&pd, &error));
358 ASSERT_EQ(pd.type, PuffData::Type::kLiterals);
359 ASSERT_EQ(pd.length, 1 << 16);
360 for (size_t i = 0; i < pd.length; i++) {
362 pd.read_fn(&byte, 1);
367 pd.type = PuffData::Type::kBlockMetadata;
368 pd.length = 1;
369 ASSERT_TRUE(pw2.Insert(pd, &error));
371 pd.type = PuffData::Type::kLiteral;
372 pd.length = 1;
373 pd.byte = 12;
376 ASSERT_TRUE(pw2.Insert(pd, &error));
379 pd.byte = 13;
380 ASSERT_TRUE(pw2.Insert(pd, &error));
385 ASSERT_TRUE(pr2.GetNext(&pd, &error));
386 ASSERT_EQ(pd.type, PuffData::Type::kBlockMetadata);
390 ASSERT_TRUE(pr2.GetNext(&pd, &error));
391 ASSERT_EQ(pd.type, PuffData::Type::kLiterals);
392 ASSERT_EQ(pd.length, (1 << 16) + 127);
393 for (size_t i = 0; i < pd.length; i++) {
395 pd.read_fn(&byte, 1);
399 ASSERT_TRUE(pr2.GetNext(&pd, &error));
400 ASSERT_EQ(pd.type, PuffData::Type::kLiterals);
401 ASSERT_EQ(pd.length, 1);
403 pd.read_fn(&byte, 1);