diff options
author | Elliott Hughes <enh@google.com> | 2024-04-10 15:39:59 +0000 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2024-04-10 15:39:59 +0000 |
commit | 3a75c2f506a25f750bdee334cb82c426e3ce31fa (patch) | |
tree | f766371b57f93044af6a42441667bbe3f7e1820c | |
parent | 8a0ab91114cef66897b764aa913bee6a3b81c1a6 (diff) | |
parent | 7d77fb7fd66d8a5640618ad32c71fdeb7d3e02df (diff) | |
download | zlib-3a75c2f506a25f750bdee334cb82c426e3ce31fa.tar.gz |
Upgrade zlib to 7d77fb7fd66d8a5640618ad32c71fdeb7d3e02df
This project was upgraded with external_updater.
Usage: tools/external_updater/updater.sh update external/zlib
For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md
Test: TreeHugger
Change-Id: I0b342eb36d05037da3013dd3c624b4cee7839cc5
-rw-r--r-- | METADATA | 4 | ||||
-rw-r--r-- | contrib/tests/utils_unittest.cc | 24 |
2 files changed, 24 insertions, 4 deletions
@@ -9,11 +9,11 @@ third_party { last_upgrade_date { year: 2024 month: 4 - day: 9 + day: 10 } identifier { type: "Git" value: "https://chromium.googlesource.com/chromium/src/third_party/zlib/" - version: "37d9855c8db5a130571971e78fde2740314cd98a" + version: "7d77fb7fd66d8a5640618ad32c71fdeb7d3e02df" } } diff --git a/contrib/tests/utils_unittest.cc b/contrib/tests/utils_unittest.cc index 0cc1081..f487a06 100644 --- a/contrib/tests/utils_unittest.cc +++ b/contrib/tests/utils_unittest.cc @@ -20,7 +20,8 @@ #include "zlib.h" -void TestPayloads(size_t input_size, zlib_internal::WrapperType type) { +void TestPayloads(size_t input_size, zlib_internal::WrapperType type, + const int compression_level = Z_DEFAULT_COMPRESSION) { std::vector<unsigned char> input; input.reserve(input_size); for (size_t i = 1; i <= input_size; ++i) @@ -36,7 +37,7 @@ void TestPayloads(size_t input_size, zlib_internal::WrapperType type) { unsigned long compressed_size = static_cast<unsigned long>(compressed.size()); int result = zlib_internal::CompressHelper( type, compressed.data(), &compressed_size, input.data(), input.size(), - Z_DEFAULT_COMPRESSION, nullptr, nullptr); + compression_level, nullptr, nullptr); ASSERT_EQ(result, Z_OK); unsigned long decompressed_size = @@ -67,6 +68,25 @@ TEST(ZlibTest, RawWrapper) { TestPayloads(i, zlib_internal::WrapperType::ZRAW); } +TEST(ZlibTest, LargePayloads) { + static const size_t lengths[] = { 6000, 8000, 10'000, 15'000, 20'000, 30'000, + 50'000, 100'000, 150'000, 2'500'000, + 5'000'000, 10'000'000, 20'000'000 }; + + for (size_t length: lengths) { + TestPayloads(length, zlib_internal::WrapperType::ZLIB); + TestPayloads(length, zlib_internal::WrapperType::GZIP); + } +} + +TEST(ZlibTest, CompressionLevels) { + static const int levels[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + for (int level: levels) { + TestPayloads(5'000'000, zlib_internal::WrapperType::ZLIB, level); + TestPayloads(5'000'000, zlib_internal::WrapperType::GZIP, level); + } +} + TEST(ZlibTest, InflateCover) { cover_support(); cover_wrap(); |