aboutsummaryrefslogtreecommitdiffstats
path: root/unittests
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-18 18:26:35 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-18 18:26:35 +0000
commit5caba3bcb14fae4b36924463ed2bcf3846f029a9 (patch)
tree3e546f1a41a93abb66d7e95091fd123f8e788316 /unittests
parentf8bc801c6cbaa1a7d34d779266755a86c97f5650 (diff)
downloadexternal_llvm-5caba3bcb14fae4b36924463ed2bcf3846f029a9.zip
external_llvm-5caba3bcb14fae4b36924463ed2bcf3846f029a9.tar.gz
external_llvm-5caba3bcb14fae4b36924463ed2bcf3846f029a9.tar.bz2
Add StringRef::count({char,StringRef})
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79354 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/ADT/StringRefTest.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/unittests/ADT/StringRefTest.cpp b/unittests/ADT/StringRefTest.cpp
index 972201c..ef89e9f 100644
--- a/unittests/ADT/StringRefTest.cpp
+++ b/unittests/ADT/StringRefTest.cpp
@@ -94,6 +94,13 @@ TEST(StringRefTest, Utilities) {
EXPECT_TRUE(Str.find("hello") == 0);
EXPECT_TRUE(Str.find("ello") == 1);
EXPECT_TRUE(Str.find("zz") == StringRef::npos);
+
+ EXPECT_TRUE(Str.count('l') == 2);
+ EXPECT_TRUE(Str.count('z') == 0);
+ EXPECT_TRUE(Str.count("helloworld") == 0);
+ EXPECT_TRUE(Str.count("hello") == 1);
+ EXPECT_TRUE(Str.count("ello") == 1);
+ EXPECT_TRUE(Str.count("zz") == 0);
}
} // end anonymous namespace