summaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-12-31 04:24:34 +0000
committerDouglas Gregor <dgregor@apple.com>2009-12-31 04:24:34 +0000
commit7e54d5b1562f085c898bf8fcc4ac939ec893444c (patch)
tree129e2694319cb77296b59d0c36bda097ec576407 /unittests
parent210d0febc24551aed293b903562c19567e96fa5d (diff)
downloadllvm-7e54d5b1562f085c898bf8fcc4ac939ec893444c.tar.gz
llvm-7e54d5b1562f085c898bf8fcc4ac939ec893444c.tar.bz2
llvm-7e54d5b1562f085c898bf8fcc4ac939ec893444c.tar.xz
Document the edit-distance algorithm used in StringRef, switch it over
to SmallVector, and add a unit test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92340 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/ADT/StringRefTest.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/unittests/ADT/StringRefTest.cpp b/unittests/ADT/StringRefTest.cpp
index 6507c20b2b..8507efa186 100644
--- a/unittests/ADT/StringRefTest.cpp
+++ b/unittests/ADT/StringRefTest.cpp
@@ -247,6 +247,11 @@ TEST(StringRefTest, Count) {
EXPECT_EQ(0U, Str.count("zz"));
}
+TEST(StringRefTest, EditDistance) {
+ StringRef Str("hello");
+ EXPECT_EQ(2, Str.edit_distance("hill"));
+}
+
TEST(StringRefTest, Misc) {
std::string Storage;
raw_string_ostream OS(Storage);