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

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

Issue 1090303003: Add missing operators for CFX_ByteStringC. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: use size_t 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/src/fxcrt/fx_basic_bstring.cpp ('k') | core/src/fxcrt/fx_basic_buffer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxcrt/fx_basic_bstring_unittest.cpp
diff --git a/core/src/fxcrt/fx_basic_bstring_unittest.cpp b/core/src/fxcrt/fx_basic_bstring_unittest.cpp
index 53427e36509731c3d523029c1b90697392fb9879..8f6f2d11de39c5c6fbf901c5013e5290b9986e6e 100644
--- a/core/src/fxcrt/fx_basic_bstring_unittest.cpp
+++ b/core/src/fxcrt/fx_basic_bstring_unittest.cpp
@@ -190,3 +190,42 @@ TEST(fxcrt, ByteStringCGetAt) {
EXPECT_EQ('\0', embedded_nul_string.GetAt(2));
EXPECT_EQ('c', embedded_nul_string.GetAt(3));
}
+
+TEST(fxcrt, ByteStringCOperatorSubscript) {
+ // CFX_ByteStringC includes the NUL terminator for non-empty strings.
+ CFX_ByteStringC abc("abc");
+ EXPECT_EQ('a', abc[0]);
+ EXPECT_EQ('b', abc[1]);
+ EXPECT_EQ('c', abc[2]);
+ EXPECT_EQ(0, abc[3]);
+}
+
+TEST(fxcrt, ByteStringCOperatorLT) {
+ CFX_ByteStringC empty;
+ CFX_ByteStringC a("a");
+ CFX_ByteStringC abc("abc");
+ CFX_ByteStringC def("def");
+
+ 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/src/fxcrt/fx_basic_bstring.cpp ('k') | core/src/fxcrt/fx_basic_buffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698