diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:18:58 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:18:58 +0000 |
| commit | 53a420fba21cf1644972b34dcd811a43cdb8368d (patch) | |
| tree | 66a19f6f8b65215772549a51d688492ab8addc0d /test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp | |
| parent | b50f1549701eb950921e5d6f2e55ba1a1dadbb43 (diff) | |
Notes
Diffstat (limited to 'test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp')
| -rw-r--r-- | test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp b/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp index 55fc63d06214..dac8860f9a64 100644 --- a/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp +++ b/test/std/strings/basic.string/string.modifiers/string_append/iterator.pass.cpp @@ -178,4 +178,30 @@ int main() test_exceptions(S(), TIter(s, s+10, 6, TIter::TAComparison), TIter()); } #endif + + { // test appending to self + typedef std::string S; + S s_short = "123/"; + S s_long = "Lorem ipsum dolor sit amet, consectetur/"; + + s_short.append(s_short.begin(), s_short.end()); + assert(s_short == "123/123/"); + s_short.append(s_short.begin(), s_short.end()); + assert(s_short == "123/123/123/123/"); + s_short.append(s_short.begin(), s_short.end()); + assert(s_short == "123/123/123/123/123/123/123/123/"); + + s_long.append(s_long.begin(), s_long.end()); + assert(s_long == "Lorem ipsum dolor sit amet, consectetur/Lorem ipsum dolor sit amet, consectetur/"); + } + + { // test appending a different type + typedef std::string S; + const uint8_t p[] = "ABCD"; + + S s; + s.append(p, p + 4); + assert(s == "ABCD"); + } + } |
