From 4a719da74b64e510f957f473dbe71677c2002036 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 18 Aug 2009 18:26:35 +0000 Subject: Add StringRef::count({char,StringRef}) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79354 91177308-0d34-0410-b5e6-96231b3b80d8 --- unittests/ADT/StringRefTest.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'unittests') 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 -- cgit v1.1