Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: third_party/WebKit/Source/platform/wtf/PtrUtilTest.cpp

Issue 2787223002: Add more WTF::PtrUtil unit tests (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698