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

Side by Side Diff: base/strings/string_piece_unittest.cc

Issue 2595063002: debuggng for PR31361
Patch Set: build on android too Created 4 years 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 | « base/strings/string_number_conversions_unittest.cc ('k') | base/test/run_all_base_unittests.cc » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 namespace base { 14 namespace base {
15 15
16
16 template <typename T> 17 template <typename T>
17 class CommonStringPieceTest : public ::testing::Test { 18 class CommonStringPieceTest : public ::testing::Test {
18 public: 19 public:
19 static const T as_string(const char* input) { 20 static const T as_string(const char* input) {
20 return T(input); 21 return T(input);
21 } 22 }
22 static const T& as_string(const T& input) { 23 static const T& as_string(const T& input) {
23 return input; 24 return input;
24 } 25 }
25 }; 26 };
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 d.clear(); 188 d.clear();
188 ASSERT_EQ(d.size(), 0U); 189 ASSERT_EQ(d.size(), 0U);
189 ASSERT_TRUE(d.empty()); 190 ASSERT_TRUE(d.empty());
190 ASSERT_TRUE(d.data() == NULL); 191 ASSERT_TRUE(d.data() == NULL);
191 ASSERT_TRUE(d.begin() == d.end()); 192 ASSERT_TRUE(d.begin() == d.end());
192 193
193 ASSERT_GE(a.max_size(), a.capacity()); 194 ASSERT_GE(a.max_size(), a.capacity());
194 ASSERT_GE(a.capacity(), a.size()); 195 ASSERT_GE(a.capacity(), a.size());
195 } 196 }
196 197
198 namespace {
197 TYPED_TEST(CommonStringPieceTest, CheckFind) { 199 TYPED_TEST(CommonStringPieceTest, CheckFind) {
198 typedef BasicStringPiece<TypeParam> Piece; 200 typedef BasicStringPiece<TypeParam> Piece;
199 201
200 TypeParam alphabet(TestFixture::as_string("abcdefghijklmnopqrstuvwxyz")); 202 TypeParam alphabet(TestFixture::as_string("abcdefghijklmnopqrstuvwxyz"));
201 TypeParam abc(TestFixture::as_string("abc")); 203 TypeParam abc(TestFixture::as_string("abc"));
202 TypeParam xyz(TestFixture::as_string("xyz")); 204 TypeParam xyz(TestFixture::as_string("xyz"));
203 TypeParam foobar(TestFixture::as_string("foobar")); 205 TypeParam foobar(TestFixture::as_string("foobar"));
204 206
205 BasicStringPiece<TypeParam> a(alphabet); 207 BasicStringPiece<TypeParam> a(alphabet);
206 BasicStringPiece<TypeParam> b(abc); 208 BasicStringPiece<TypeParam> b(abc);
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(NULL)); 683 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(NULL));
682 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(NULL, 684 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(NULL,
683 static_cast<typename BasicStringPiece<TypeParam>::size_type>(0))); 685 static_cast<typename BasicStringPiece<TypeParam>::size_type>(0)));
684 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>()); 686 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>());
685 ASSERT_TRUE(str == BasicStringPiece<TypeParam>(str.begin(), str.end())); 687 ASSERT_TRUE(str == BasicStringPiece<TypeParam>(str.begin(), str.end()));
686 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(str.begin(), str.begin())); 688 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(str.begin(), str.begin()));
687 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(empty)); 689 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(empty));
688 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(empty.begin(), empty.end())); 690 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(empty.begin(), empty.end()));
689 } 691 }
690 692
693 } // namespace
694
691 } // namespace base 695 } // namespace base
OLDNEW
« no previous file with comments | « base/strings/string_number_conversions_unittest.cc ('k') | base/test/run_all_base_unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698