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

Unified Diff: core/src/fxcrt/fx_basic_wstring_unittest.cpp

Issue 1099193002: Add missing operators for CFX_WideStringC. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/include/fxcrt/fx_string.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxcrt/fx_basic_wstring_unittest.cpp
diff --git a/core/src/fxcrt/fx_basic_wstring_unittest.cpp b/core/src/fxcrt/fx_basic_wstring_unittest.cpp
index 9575dfd78689b28c04badd48fb846c4adfe6f313..084410ad19c40269be872b5eb2b8b51321974f0d 100644
--- a/core/src/fxcrt/fx_basic_wstring_unittest.cpp
+++ b/core/src/fxcrt/fx_basic_wstring_unittest.cpp
@@ -66,3 +66,43 @@ TEST(fxcrt, WideStringUTF16LE_Encode) {
<< " for case number " << i;
}
}
+
+TEST(fxcrt, WideStringCOperatorSubscript) {
+ // CFX_WideStringC includes the NUL terminator for non-empty strings.
+ CFX_WideStringC abc(L"abc");
+ EXPECT_EQ(L'a', abc[0]);
+ EXPECT_EQ(L'b', abc[1]);
+ EXPECT_EQ(L'c', abc[2]);
+ EXPECT_EQ(L'\0', abc[3]);
+}
+
+TEST(fxcrt, WideStringCOperatorLT) {
+ CFX_WideStringC empty;
+ CFX_WideStringC a(L"a");
+ CFX_WideStringC abc(L"\x0110qq"); // Comes before despite endianness.
+ CFX_WideStringC def(L"\x1001qq"); // Comes after despite endianness.
+
+ EXPECT_FALSE(empty < empty);
+ EXPECT_FALSE(a < a);
+ EXPECT_FALSE(abc < abc);
+ EXPECT_FALSE(def < def);
+
+ EXPECT_TRUE(empty < a);
+ EXPECT_FALSE(a < empty);
+
+ EXPECT_TRUE(empty < abc);
+ EXPECT_FALSE(abc < empty);
+
+ EXPECT_TRUE(empty < def);
+ EXPECT_FALSE(def < empty);
+
+ EXPECT_TRUE(a < abc);
+ EXPECT_FALSE(abc < a);
+
+ EXPECT_TRUE(a < def);
+ EXPECT_FALSE(def < a);
+
+ EXPECT_TRUE(abc < def);
+ EXPECT_FALSE(def < abc);
+}
+
« no previous file with comments | « core/include/fxcrt/fx_string.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698