| OLD | NEW |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/wtf/PtrUtil.h" | 5 #include "platform/wtf/PtrUtil.h" |
| 6 | 6 |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 namespace WTF { |
| 10 |
| 11 TEST(WTF_PtrUtilTest, canWrapUnique) { |
| 12 auto charPtr = new char; |
| 13 auto wrappedCharPtr = wrapUnique(charPtr); |
| 14 |
| 15 ASSERT_TRUE(wrappedCharPtr.get()); |
| 16 } |
| 17 |
| 18 TEST(WTF_PtrUtilTest, canWrapUniqueArray) { |
| 19 constexpr size_t bufferSize = 20; |
| 20 auto charArray = new char[bufferSize]; |
| 21 auto wrappedCharArray = wrapArrayUnique(charArray); |
| 22 |
| 23 ASSERT_TRUE(wrappedCharArray.get()); |
| 24 } |
| 25 |
| 26 TEST(WTF_PtrUtilTest, canMakeUnique) { |
| 27 auto charPtr = makeUnique<char>(); |
| 28 |
| 29 ASSERT_TRUE(charPtr.get()); |
| 30 } |
| 31 |
| 9 TEST(WTF_PtrUtilTest, canMakeUniqueArray) { | 32 TEST(WTF_PtrUtilTest, canMakeUniqueArray) { |
| 10 constexpr size_t bufferSize = 20; | 33 constexpr size_t bufferSize = 20; |
| 11 auto charArray = WTF::makeUnique<char[]>(bufferSize); | 34 auto charArray = makeUnique<char[]>(bufferSize); |
| 12 | 35 |
| 13 ASSERT_TRUE(charArray.get()); | 36 ASSERT_TRUE(charArray.get()); |
| 14 } | 37 } |
| 38 } |
| OLD | NEW |