diff options
| author | David Blaikie <dblaikie@gmail.com> | 2014-03-09 06:17:01 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2014-03-09 06:17:01 +0000 |
| commit | d028adf7bc92c0595167bf41269ccded4e2f2823 (patch) | |
| tree | 56483c9672d911c64ebb4e0fa29161bc34e71c9a /llvm/unittests/ADT/SmallStringTest.cpp | |
| parent | dcb72d72ff373d1baa3c25782604f60756d0d803 (diff) | |
| download | bcm5719-llvm-d028adf7bc92c0595167bf41269ccded4e2f2823.tar.gz bcm5719-llvm-d028adf7bc92c0595167bf41269ccded4e2f2823.zip | |
Clean up SmallString a bit
Move a common utility (assign(iter, iter)) into SmallVector (some of the
others could be moved there too, but this one seemed particularly
generic) and replace repetitions overrides with using directives.
And simplify SmallVector::assign(num, element) while I'm here rather
than thrashing these files (that cause everyone to rebuild) again.
llvm-svn: 203374
Diffstat (limited to 'llvm/unittests/ADT/SmallStringTest.cpp')
| -rw-r--r-- | llvm/unittests/ADT/SmallStringTest.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/llvm/unittests/ADT/SmallStringTest.cpp b/llvm/unittests/ADT/SmallStringTest.cpp index 9398e99c911..ff04f5bd57f 100644 --- a/llvm/unittests/ADT/SmallStringTest.cpp +++ b/llvm/unittests/ADT/SmallStringTest.cpp @@ -50,13 +50,6 @@ TEST_F(SmallStringTest, AssignRepeated) { EXPECT_STREQ("aaa", theString.c_str()); } -TEST_F(SmallStringTest, AssignIterPair) { - StringRef abc = "abc"; - theString.assign(abc.begin(), abc.end()); - EXPECT_EQ(3u, theString.size()); - EXPECT_STREQ("abc", theString.c_str()); -} - TEST_F(SmallStringTest, AssignStringRef) { StringRef abc = "abc"; theString.assign(abc); @@ -88,6 +81,23 @@ TEST_F(SmallStringTest, AppendStringRef) { EXPECT_STREQ("abcabc", theString.c_str()); } +TEST_F(SmallStringTest, PlusEqualsStringRef) { + StringRef abc = "abc"; + theString += abc; + theString += abc; + EXPECT_EQ(6u, theString.size()); + EXPECT_STREQ("abcabc", theString.c_str()); +} + +TEST_F(SmallStringTest, PlusEqualsSmallVector) { + StringRef abc = "abc"; + SmallVector<char, 10> abcVec(abc.begin(), abc.end()); + theString += abcVec; + theString += abcVec; + EXPECT_EQ(6u, theString.size()); + EXPECT_STREQ("abcabc", theString.c_str()); +} + TEST_F(SmallStringTest, AppendSmallVector) { StringRef abc = "abc"; SmallVector<char, 10> abcVec(abc.begin(), abc.end()); |

