393 constexpr
uint64_t uncompressedLength = 42;
395 auto compressed =
codec_->compress(original.get());
397 if (!
codec_->needsUncompressedLength()) {
398 auto uncompressed =
codec_->uncompress(compressed.get());
399 EXPECT_EQ(uncompressedLength, uncompressed->computeChainDataLength());
404 codec_->uncompress(compressed.get(), uncompressedLength);
405 EXPECT_EQ(uncompressedLength, uncompressed->computeChainDataLength());
410 codec_->uncompress(compressed.get(), uncompressedLength + 1),
413 auto corrupted = compressed->clone();
414 corrupted->unshare();
416 corrupted->prev()->trimEnd(1);
417 if (!
codec_->needsUncompressedLength()) {
422 codec_->uncompress(corrupted.get(), uncompressedLength),
425 corrupted = compressed->clone();
426 corrupted->unshare();
428 ++(corrupted->writableData()[0]);
430 if (!
codec_->needsUncompressedLength()) {
435 codec_->uncompress(corrupted.get(), uncompressedLength),
std::unique_ptr< Codec > codec_
#define EXPECT_THROW(statement, expected_exception)
static std::unique_ptr< IOBuf > wrapBuffer(const void *buf, std::size_t capacity)
#define EXPECT_EQ(val1, val2)
uint64_t hashIOBuf(const IOBuf *buf)