OLD | NEW |
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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
8 #include "base/strings/string_piece.h" | 8 #include "base/strings/string_piece.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 } | 667 } |
668 | 668 |
669 TYPED_TEST(CommonStringPieceTest, CheckConstructors) { | 669 TYPED_TEST(CommonStringPieceTest, CheckConstructors) { |
670 TypeParam str(TestFixture::as_string("hello world")); | 670 TypeParam str(TestFixture::as_string("hello world")); |
671 TypeParam empty; | 671 TypeParam empty; |
672 | 672 |
673 ASSERT_TRUE(str == BasicStringPiece<TypeParam>(str)); | 673 ASSERT_TRUE(str == BasicStringPiece<TypeParam>(str)); |
674 ASSERT_TRUE(str == BasicStringPiece<TypeParam>(str.c_str())); | 674 ASSERT_TRUE(str == BasicStringPiece<TypeParam>(str.c_str())); |
675 ASSERT_TRUE(TestFixture::as_string("hello") == | 675 ASSERT_TRUE(TestFixture::as_string("hello") == |
676 BasicStringPiece<TypeParam>(str.c_str(), 5)); | 676 BasicStringPiece<TypeParam>(str.c_str(), 5)); |
677 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(str.c_str(), 0U)); | 677 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(str.c_str(), |
| 678 static_cast<typename BasicStringPiece<TypeParam>::size_type>(0))); |
678 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(NULL)); | 679 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(NULL)); |
679 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(NULL, 0U)); | 680 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(NULL, |
| 681 static_cast<typename BasicStringPiece<TypeParam>::size_type>(0))); |
680 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>()); | 682 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>()); |
681 ASSERT_TRUE(str == BasicStringPiece<TypeParam>(str.begin(), str.end())); | 683 ASSERT_TRUE(str == BasicStringPiece<TypeParam>(str.begin(), str.end())); |
682 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(str.begin(), str.begin())); | 684 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(str.begin(), str.begin())); |
683 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(empty)); | 685 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(empty)); |
684 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(empty.begin(), empty.end())); | 686 ASSERT_TRUE(empty == BasicStringPiece<TypeParam>(empty.begin(), empty.end())); |
685 } | 687 } |
686 | 688 |
687 } // namespace base | 689 } // namespace base |
OLD | NEW |