diff options
author | tsepez <tsepez@chromium.org> | 2016-05-11 17:35:35 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-11 17:35:35 -0700 |
commit | f7fe678a4ada859a2e4fbbeeb0b1dff5b5887227 (patch) | |
tree | 271f61e203bcb7026db6b4936668f51f7f5e0de8 /core/fxcrt/fx_basic_bstring_unittest.cpp | |
parent | 94dfd56acc7ceb2acfc2e5c7ae516e34b160ea15 (diff) | |
download | pdfium-f7fe678a4ada859a2e4fbbeeb0b1dff5b5887227.tar.xz |
Add much-needed Find() method for CFX_*StringC
BUG=pdfium:493
Review-Url: https://codereview.chromium.org/1968233002
Diffstat (limited to 'core/fxcrt/fx_basic_bstring_unittest.cpp')
-rw-r--r-- | core/fxcrt/fx_basic_bstring_unittest.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/core/fxcrt/fx_basic_bstring_unittest.cpp b/core/fxcrt/fx_basic_bstring_unittest.cpp index 087c264940..fe98b53b45 100644 --- a/core/fxcrt/fx_basic_bstring_unittest.cpp +++ b/core/fxcrt/fx_basic_bstring_unittest.cpp @@ -802,6 +802,31 @@ TEST(fxcrt, ByteStringCGetID) { EXPECT_EQ(0u, longer_string.GetID(-1000000)); } +TEST(fxcrt, ByteStringCFind) { + CFX_ByteStringC null_string; + EXPECT_EQ(-1, null_string.Find('a')); + EXPECT_EQ(-1, null_string.Find(0)); + + CFX_ByteStringC empty_string(""); + EXPECT_EQ(-1, empty_string.Find('a')); + EXPECT_EQ(-1, empty_string.Find(0)); + + CFX_ByteStringC single_string("a"); + EXPECT_EQ(0, single_string.Find('a')); + EXPECT_EQ(-1, single_string.Find('b')); + EXPECT_EQ(-1, single_string.Find(0)); + + CFX_ByteStringC longer_string("abccc"); + EXPECT_EQ(0, longer_string.Find('a')); + EXPECT_EQ(2, longer_string.Find('c')); + EXPECT_EQ(-1, longer_string.Find(0)); + + CFX_ByteStringC hibyte_string( + "ab\x8c" + "def"); + EXPECT_EQ(2, hibyte_string.Find('\x8c')); +} + TEST(fxcrt, ByteStringCMid) { CFX_ByteStringC null_string; EXPECT_EQ(null_string, null_string.Mid(0, 1)); |