Skip to content

Commit

Permalink
TESTS: Add a test for the even-divide case in INFLATE without size
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMcCoy committed Aug 5, 2018
1 parent 43d7a44 commit e31e98a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/common/deflate.cpp
Expand Up @@ -103,6 +103,22 @@ GTEST_TEST(DEFLATE, decompressBufWithoutDecompressedSize) {
delete[] decompressed;
}

GTEST_TEST(DEFLATE, decompressBufWithoutDecompressedSizeFrameSizeEvenDivide) {
static const size_t kSizeCompressed = sizeof(kDataCompressed);
static const size_t kSizeDecompressed = strlen(kDataUncompressed);

size_t size = 0;
const byte *decompressed =
Common::decompressDeflateWithoutOutputSize(kDataCompressed, kSizeCompressed, size, Common::kWindowBitsMaxRaw, 89);
ASSERT_NE(decompressed, static_cast<const byte *>(0));
ASSERT_EQ(size, kSizeDecompressed);

for (size_t i = 0; i < kSizeDecompressed; i++)
EXPECT_EQ(decompressed[i], kDataUncompressed[i]) << "At index " << i;

delete[] decompressed;
}

GTEST_TEST(DEFLATE, decompressStream) {
static const size_t kSizeCompressed = sizeof(kDataCompressed);
static const size_t kSizeDecompressed = strlen(kDataUncompressed);
Expand Down

0 comments on commit e31e98a

Please sign in to comment.