Replace OwningPtr<T> with std::unique_ptr<T>.
[oota-llvm.git] / unittests / Support / CompressionTest.cpp
index aad7ed0e89a185c0911b091ed7e0f62f9db23fc9..db6a8bb1463864907d1cdf734d0b7c8937effcb1 100644 (file)
@@ -12,7 +12,6 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Support/Compression.h"
-#include "llvm/ADT/OwningPtr.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Config/config.h"
 #include "llvm/Support/MemoryBuffer.h"
@@ -22,11 +21,11 @@ using namespace llvm;
 
 namespace {
 
-#if LLVM_ENABLE_ZLIB == 1
+#if LLVM_ENABLE_ZLIB == 1 && HAVE_LIBZ
 
 void TestZlibCompression(StringRef Input, zlib::CompressionLevel Level) {
-  OwningPtr<MemoryBuffer> Compressed;
-  OwningPtr<MemoryBuffer> Uncompressed;
+  std::unique_ptr<MemoryBuffer> Compressed;
+  std::unique_ptr<MemoryBuffer> 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(),
@@ -63,6 +62,12 @@ TEST(CompressionTest, Zlib) {
   TestZlibCompression(BinaryDataStr, zlib::DefaultCompression);
 }
 
+TEST(CompressionTest, ZlibCRC32) {
+  EXPECT_EQ(
+      0x414FA339U,
+      zlib::crc32(StringRef("The quick brown fox jumps over the lazy dog")));
+}
+
 #endif
 
 }