diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-12-31 04:24:34 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-12-31 04:24:34 +0000 |
commit | 5639af4eac2bb44aa96c7c3cd3cdef30f9c80590 (patch) | |
tree | ae4fd4f043c37dc418579fd0251ad7da16c2679e /llvm/unittests/ADT/StringRefTest.cpp | |
parent | b0283c06b2dfd01c0fbdc52acfe9cc3f556bed90 (diff) | |
download | llvm-5639af4eac2bb44aa96c7c3cd3cdef30f9c80590.zip llvm-5639af4eac2bb44aa96c7c3cd3cdef30f9c80590.tar.gz llvm-5639af4eac2bb44aa96c7c3cd3cdef30f9c80590.tar.bz2 |
Document the edit-distance algorithm used in StringRef, switch it over
to SmallVector, and add a unit test.
llvm-svn: 92340
Diffstat (limited to 'llvm/unittests/ADT/StringRefTest.cpp')
-rw-r--r-- | llvm/unittests/ADT/StringRefTest.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/unittests/ADT/StringRefTest.cpp b/llvm/unittests/ADT/StringRefTest.cpp index 6507c20..8507efa 100644 --- a/llvm/unittests/ADT/StringRefTest.cpp +++ b/llvm/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); |