| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium 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 "core/fxcrt/include/fx_basic.h" | 5 #include "core/fxcrt/include/fx_basic.h" |
| 6 #include "testing/fx_string_testhelpers.h" | 6 #include "testing/fx_string_testhelpers.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 TEST(fxcrt, WideStringOperatorSubscript) { | 9 TEST(fxcrt, WideStringOperatorSubscript) { |
| 10 // CFX_WideString includes the NUL terminator for non-empty strings. | 10 // CFX_WideString includes the NUL terminator for non-empty strings. |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 for (size_t i = 0; i < FX_ArraySize(utf16le_encode_cases); ++i) { | 684 for (size_t i = 0; i < FX_ArraySize(utf16le_encode_cases); ++i) { |
| 685 EXPECT_EQ(utf16le_encode_cases[i].bs, | 685 EXPECT_EQ(utf16le_encode_cases[i].bs, |
| 686 utf16le_encode_cases[i].ws.UTF16LE_Encode()) | 686 utf16le_encode_cases[i].ws.UTF16LE_Encode()) |
| 687 << " for case number " << i; | 687 << " for case number " << i; |
| 688 } | 688 } |
| 689 } | 689 } |
| 690 | 690 |
| 691 TEST(fxcrt, WideStringCOperatorSubscript) { | 691 TEST(fxcrt, WideStringCOperatorSubscript) { |
| 692 // CFX_WideStringC includes the NUL terminator for non-empty strings. | 692 // CFX_WideStringC includes the NUL terminator for non-empty strings. |
| 693 CFX_WideStringC abc(L"abc"); | 693 CFX_WideStringC abc(L"abc"); |
| 694 EXPECT_EQ(L'a', abc[0]); | 694 EXPECT_EQ(L'a', abc.CharAt(0)); |
| 695 EXPECT_EQ(L'b', abc[1]); | 695 EXPECT_EQ(L'b', abc.CharAt(1)); |
| 696 EXPECT_EQ(L'c', abc[2]); | 696 EXPECT_EQ(L'c', abc.CharAt(2)); |
| 697 EXPECT_EQ(L'\0', abc[3]); | 697 EXPECT_EQ(L'\0', abc.CharAt(3)); |
| 698 } | 698 } |
| 699 | 699 |
| 700 TEST(fxcrt, WideStringCOperatorLT) { | 700 TEST(fxcrt, WideStringCOperatorLT) { |
| 701 CFX_WideStringC empty; | 701 CFX_WideStringC empty; |
| 702 CFX_WideStringC a(L"a"); | 702 CFX_WideStringC a(L"a"); |
| 703 CFX_WideStringC abc(L"\x0110qq"); // Comes before despite endianness. | 703 CFX_WideStringC abc(L"\x0110qq"); // Comes before despite endianness. |
| 704 CFX_WideStringC def(L"\x1001qq"); // Comes after despite endianness. | 704 CFX_WideStringC def(L"\x1001qq"); // Comes after despite endianness. |
| 705 | 705 |
| 706 EXPECT_FALSE(empty < empty); | 706 EXPECT_FALSE(empty < empty); |
| 707 EXPECT_FALSE(a < a); | 707 EXPECT_FALSE(a < a); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 } | 932 } |
| 933 } | 933 } |
| 934 | 934 |
| 935 TEST(fxcrt, EmptyWideString) { | 935 TEST(fxcrt, EmptyWideString) { |
| 936 CFX_WideString empty_str; | 936 CFX_WideString empty_str; |
| 937 EXPECT_TRUE(empty_str.IsEmpty()); | 937 EXPECT_TRUE(empty_str.IsEmpty()); |
| 938 EXPECT_EQ(0, empty_str.GetLength()); | 938 EXPECT_EQ(0, empty_str.GetLength()); |
| 939 const FX_WCHAR* cstr = empty_str.c_str(); | 939 const FX_WCHAR* cstr = empty_str.c_str(); |
| 940 EXPECT_EQ(0, FXSYS_wcslen(cstr)); | 940 EXPECT_EQ(0, FXSYS_wcslen(cstr)); |
| 941 } | 941 } |
| OLD | NEW |