TEST_F(ZlibDecompressorImplTest, FailedDecompression) {
  Buffer::OwnedImpl buffer;
  Buffer::OwnedImpl accumulation_buffer;

  std::string original_text{};
  for (uint64_t i = 0; i < 20; ++i) {
    TestUtility::feedBufferWithRandomCharacters(buffer, default_input_size * i, i);
    original_text.append(buffer.toString());
    accumulation_buffer.add(buffer);
    drainBuffer(buffer);
  }
  Stats::IsolatedStoreImpl stats_store{};
  ZlibDecompressorImpl decompressor{stats_store, "test."};
  decompressor.init(gzip_window_bits);

  decompressor.decompress(accumulation_buffer, buffer);

  ASSERT_TRUE(decompressor.decompression_error_ < 0);
  ASSERT_EQ(stats_store.counterFromString("test.zlib_data_error").value(), 17);
}
TEST_F(ZlibDecompressorImplTest, FailedDecompression) {
  Buffer::OwnedImpl buffer;
  Buffer::OwnedImpl accumulation_buffer;

  std::string original_text{};
  for (uint64_t i = 0; i < 20; ++i) {
    TestUtility::feedBufferWithRandomCharacters(buffer, default_input_size * i, i);
    original_text.append(buffer.toString());
    accumulation_buffer.add(buffer);
    drainBuffer(buffer);
  }
  Stats::IsolatedStoreImpl stats_store{};
  ZlibDecompressorImpl decompressor{stats_store, "test."};
  decompressor.init(gzip_window_bits);

  decompressor.decompress(accumulation_buffer, buffer);

  ASSERT_TRUE(decompressor.decompression_error_ < 0);
  ASSERT_EQ(stats_store.counterFromString("test.zlib_data_error").value(), 17);
}