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 c6e5c2f3d0b790aebb145a2df4e26dbe3fa9d7ce..287541eeb2dbbeee637eac159e1d0c6d1458456c 100644 |
--- a/core/src/fxcrt/fx_basic_wstring_unittest.cpp |
+++ b/core/src/fxcrt/fx_basic_wstring_unittest.cpp |
@@ -6,6 +6,45 @@ |
#include "../../../testing/fx_string_testhelpers.h" |
#include "../../include/fxcrt/fx_basic.h" |
+TEST(fxcrt, WideStringOperatorSubscript) { |
+ // CFX_WideString includes the NUL terminator for non-empty strings. |
+ CFX_WideString abc(L"abc"); |
+ EXPECT_EQ('a', abc[0]); |
Lei Zhang
2015/04/21 22:12:33
Also concerned whether this actually compiles.
|
+ EXPECT_EQ('b', abc[1]); |
+ EXPECT_EQ('c', abc[2]); |
+ EXPECT_EQ(0, abc[3]); |
+} |
+ |
+TEST(fxcrt, WideStringOperatorLT) { |
+ CFX_WideString empty; |
+ CFX_WideString a(L"a"); |
+ CFX_WideString abc(L"\x0110qq"); // Comes before despite endianness. |
+ CFX_WideString 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); |
+} |
+ |
#define ByteStringLiteral(str) CFX_ByteString(FX_BSTRC(str)) |
TEST(fxcrt, WideStringUTF16LE_Encode) { |