diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-11-11 00:28:53 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-11-11 00:28:53 +0000 |
commit | 64066bd8b593082f622bbc25716938a453363d2f (patch) | |
tree | a388003855cae002ff0e7875abfb7b72e666891d /unittests/ADT | |
parent | 253e9b2990b090162e389475c4ef419ff7e2c5d1 (diff) | |
download | external_llvm-64066bd8b593082f622bbc25716938a453363d2f.zip external_llvm-64066bd8b593082f622bbc25716938a453363d2f.tar.gz external_llvm-64066bd8b593082f622bbc25716938a453363d2f.tar.bz2 |
Add From arguments to StringRef search functions, and tweak doxyments.
Also, add unittests for find_first_of and find_first_not_of.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86770 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/ADT')
-rw-r--r-- | unittests/ADT/StringRefTest.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/unittests/ADT/StringRefTest.cpp b/unittests/ADT/StringRefTest.cpp index cdc476e..7828b5f 100644 --- a/unittests/ADT/StringRefTest.cpp +++ b/unittests/ADT/StringRefTest.cpp @@ -125,6 +125,8 @@ TEST(StringRefTest, Find) { EXPECT_EQ(0U, Str.find("hello")); EXPECT_EQ(1U, Str.find("ello")); EXPECT_EQ(StringRef::npos, Str.find("zz")); + EXPECT_EQ(2U, Str.find("ll", 2)); + EXPECT_EQ(StringRef::npos, Str.find("ll", 3)); EXPECT_EQ(3U, Str.rfind('l')); EXPECT_EQ(StringRef::npos, Str.rfind('z')); @@ -132,6 +134,14 @@ TEST(StringRefTest, Find) { EXPECT_EQ(0U, Str.rfind("hello")); EXPECT_EQ(1U, Str.rfind("ello")); EXPECT_EQ(StringRef::npos, Str.rfind("zz")); + + EXPECT_EQ(2U, Str.find_first_of('l')); + EXPECT_EQ(1U, Str.find_first_of("el")); + EXPECT_EQ(StringRef::npos, Str.find_first_of("xyz")); + + EXPECT_EQ(1U, Str.find_first_not_of('h')); + EXPECT_EQ(4U, Str.find_first_not_of("hel")); + EXPECT_EQ(StringRef::npos, Str.find_first_not_of("hello")); } TEST(StringRefTest, Count) { |