diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-04-05 21:53:04 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-04-05 21:53:04 +0000 |
commit | b4074c010bc3d6c9a7323fabf68578b7b900a8a5 (patch) | |
tree | e64638f74295a4c9bf2dd066889c3e5bf1af04c8 /unittests | |
parent | b206103abcf358453ac4ed8d4373f44f4c88e5c0 (diff) | |
download | llvm-b4074c010bc3d6c9a7323fabf68578b7b900a8a5.tar.gz llvm-b4074c010bc3d6c9a7323fabf68578b7b900a8a5.tar.bz2 llvm-b4074c010bc3d6c9a7323fabf68578b7b900a8a5.tar.xz |
Simplify compression API by compressing into a SmallVector rather than a MemoryBuffer
This is the other half of r205676.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205677 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/Support/CompressionTest.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/unittests/Support/CompressionTest.cpp b/unittests/Support/CompressionTest.cpp index 30df0509cc..698ae3aa2f 100644 --- a/unittests/Support/CompressionTest.cpp +++ b/unittests/Support/CompressionTest.cpp @@ -13,8 +13,8 @@ #include "llvm/Support/Compression.h" #include "llvm/ADT/StringRef.h" +#include "llvm/ADT/SmallString.h" #include "llvm/Config/config.h" -#include "llvm/Support/MemoryBuffer.h" #include "gtest/gtest.h" using namespace llvm; @@ -24,19 +24,17 @@ namespace { #if LLVM_ENABLE_ZLIB == 1 && HAVE_LIBZ void TestZlibCompression(StringRef Input, zlib::CompressionLevel Level) { - std::unique_ptr<MemoryBuffer> Compressed; + SmallString<32> Compressed; SmallString<32> Uncompressed; EXPECT_EQ(zlib::StatusOK, zlib::compress(Input, Compressed, Level)); // Check that uncompressed buffer is the same as original. - EXPECT_EQ(zlib::StatusOK, zlib::uncompress(Compressed->getBuffer(), - Uncompressed, Input.size())); - EXPECT_EQ(Input.size(), Uncompressed.size()); - EXPECT_EQ(0, memcmp(Input.data(), Uncompressed.data(), Input.size())); + EXPECT_EQ(zlib::StatusOK, + zlib::uncompress(Compressed, Uncompressed, Input.size())); + EXPECT_EQ(Input, Uncompressed); if (Input.size() > 0) { // Uncompression fails if expected length is too short. EXPECT_EQ(zlib::StatusBufferTooShort, - zlib::uncompress(Compressed->getBuffer(), Uncompressed, - Input.size() - 1)); + zlib::uncompress(Compressed, Uncompressed, Input.size() - 1)); } } |