blob: 3fbfb6ce1b039a28f2dbe927b3a2b41d3cf740c8 [file] [log] [blame]
// Copyright (c) 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "platform/wtf/PtrUtil.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace WTF {
TEST(WTF_PtrUtilTest, canWrapUnique) {
auto char_ptr = new char;
auto wrapped_char_ptr = WrapUnique(char_ptr);
ASSERT_TRUE(wrapped_char_ptr.get());
}
TEST(WTF_PtrUtilTest, canWrapUniqueArray) {
constexpr size_t kBufferSize = 20;
auto char_array = new char[kBufferSize];
auto wrapped_char_array = WrapArrayUnique(char_array);
ASSERT_TRUE(wrapped_char_array.get());
}
TEST(WTF_PtrUtilTest, canMakeUnique) {
auto char_ptr = MakeUnique<char>();
ASSERT_TRUE(char_ptr.get());
}
TEST(WTF_PtrUtilTest, canMakeUniqueArray) {
constexpr size_t kBufferSize = 20;
auto char_array = MakeUnique<char[]>(kBufferSize);
ASSERT_TRUE(char_array.get());
}
}