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

Side by Side Diff: third_party/WebKit/Source/platform/WebVectorTest.cpp

Issue 2799563002: Replace usage of WebVector::isEmpty with WebVector::empty().
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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "public/platform/WebVector.h" 5 #include "public/platform/WebVector.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "wtf/StdLibExtras.h" 8 #include "wtf/StdLibExtras.h"
9 #include "wtf/Vector.h" 9 #include "wtf/Vector.h"
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 output.clear(); 42 output.clear();
43 for (int x : webVector) 43 for (int x : webVector)
44 output.push_back(x); 44 output.push_back(x);
45 ASSERT_EQ(input.size(), output.size()); 45 ASSERT_EQ(input.size(), output.size());
46 for (size_t i = 0; i < input.size(); ++i) 46 for (size_t i = 0; i < input.size(); ++i)
47 EXPECT_EQ(input[i], output[i]); 47 EXPECT_EQ(input[i], output[i]);
48 } 48 }
49 49
50 TEST(WebVectorTest, IsEmpty) { 50 TEST(WebVectorTest, IsEmpty) {
51 WebVector<int> vector; 51 WebVector<int> vector;
52 ASSERT_TRUE(vector.isEmpty()); 52 ASSERT_TRUE(vector.empty());
53 int value = 1; 53 int value = 1;
54 vector.assign(&value, 1); 54 vector.assign(&value, 1);
55 ASSERT_EQ(1u, vector.size()); 55 ASSERT_EQ(1u, vector.size());
56 ASSERT_FALSE(vector.isEmpty()); 56 ASSERT_FALSE(vector.empty());
57 } 57 }
58 58
59 TEST(WebVectorTest, Swap) { 59 TEST(WebVectorTest, Swap) {
60 const int firstData[] = {1, 2, 3, 4, 5}; 60 const int firstData[] = {1, 2, 3, 4, 5};
61 const int secondData[] = {6, 5, 8}; 61 const int secondData[] = {6, 5, 8};
62 const size_t kFirstDataLength = WTF_ARRAY_LENGTH(firstData); 62 const size_t kFirstDataLength = WTF_ARRAY_LENGTH(firstData);
63 const size_t kSecondDataLength = WTF_ARRAY_LENGTH(secondData); 63 const size_t kSecondDataLength = WTF_ARRAY_LENGTH(secondData);
64 64
65 WebVector<int> first(firstData, kFirstDataLength); 65 WebVector<int> first(firstData, kFirstDataLength);
66 WebVector<int> second(secondData, kSecondDataLength); 66 WebVector<int> second(secondData, kSecondDataLength);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 EXPECT_EQ(input[i], vector[i]); 118 EXPECT_EQ(input[i], vector[i]);
119 119
120 WebVector<int> assigned; 120 WebVector<int> assigned;
121 assigned = input; 121 assigned = input;
122 ASSERT_EQ(input.size(), assigned.size()); 122 ASSERT_EQ(input.size(), assigned.size());
123 for (size_t i = 0; i < assigned.size(); ++i) 123 for (size_t i = 0; i < assigned.size(); ++i)
124 EXPECT_EQ(input[i], assigned[i]); 124 EXPECT_EQ(input[i], assigned[i]);
125 } 125 }
126 126
127 } // namespace blink 127 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698