diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2015-12-30 11:46:15 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2015-12-30 11:46:15 +0000 |
| commit | dd58ef019b700900793a1eb48b52123db01b654e (patch) | |
| tree | fcfbb4df56a744f4ddc6122c50521dd3f1c5e196 /unittests/ADT/SmallStringTest.cpp | |
| parent | 2fe5752e3a7c345cdb59e869278d36af33c13fa4 (diff) | |
Notes
Diffstat (limited to 'unittests/ADT/SmallStringTest.cpp')
| -rw-r--r-- | unittests/ADT/SmallStringTest.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/unittests/ADT/SmallStringTest.cpp b/unittests/ADT/SmallStringTest.cpp index 9398e99c91193..995ef8e812781 100644 --- a/unittests/ADT/SmallStringTest.cpp +++ b/unittests/ADT/SmallStringTest.cpp @@ -159,6 +159,17 @@ TEST_F(SmallStringTest, Count) { EXPECT_EQ(0U, theString.count("zz")); } +TEST_F(SmallStringTest, Realloc) { + theString = "abcd"; + theString.reserve(100); + EXPECT_EQ("abcd", theString); + unsigned const N = 100000; + theString.reserve(N); + for (unsigned i = 0; i < N - 4; ++i) + theString.push_back('y'); + EXPECT_EQ("abcdyyy", theString.slice(0, 7)); +} + TEST(StringRefTest, Comparisons) { EXPECT_EQ(-1, SmallString<10>("aab").compare("aad")); EXPECT_EQ( 0, SmallString<10>("aab").compare("aab")); |
