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..358315cffec497867258a3e0f5b19b622bfb066a 100644 |
--- a/core/src/fxcrt/fx_basic_bstring_unittest.cpp |
+++ b/core/src/fxcrt/fx_basic_bstring_unittest.cpp |
@@ -2,6 +2,8 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include <map> |
+ |
#include "testing/gtest/include/gtest/gtest.h" |
#include "../../../testing/fx_string_testhelpers.h" |
#include "../../include/fxcrt/fx_basic.h" |
@@ -190,3 +192,31 @@ 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"); |
+ |
+ EXPECT_FALSE(empty < empty); |
+ EXPECT_FALSE(a < a); |
+ EXPECT_FALSE(abc < abc); |
+ |
+ EXPECT_TRUE(empty < a); |
+ EXPECT_FALSE(a < empty); |
+ |
+ EXPECT_TRUE(empty < abc); |
+ EXPECT_FALSE(abc < empty); |
+ |
+ EXPECT_TRUE(a < abc); |
+ EXPECT_FALSE(abc < a); |
+} |