]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/21_strings/basic_string/operators/char/4.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 21_strings / basic_string / operators / char / 4.cc
CommitLineData
2f8bed16
PC
1// 2010-12-19 Paolo Carlini <paolo.carlini@oracle.com>
2//
83ffe9cd 3// Copyright (C) 2010-2023 Free Software Foundation, Inc.
2f8bed16
PC
4//
5// This file is part of the GNU ISO C++ Library. This library is free
6// software; you can redistribute it and/or modify it under the
7// terms of the GNU General Public License as published by the
8// Free Software Foundation; either version 3, or (at your option)
9// any later version.
10//
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15//
16// You should have received a copy of the GNU General Public License along
17// with this library; see the file COPYING3. If not see
18// <http://www.gnu.org/licenses/>.
19//
52066eae 20// { dg-do run { target c++11 } }
2f8bed16
PC
21// { dg-require-string-conversions "" }
22
23#include <string>
24#include <testsuite_hooks.h>
25
26void test01()
27{
2f8bed16
PC
28 using std::string;
29 using std::move;
30
31 string s01("abc");
32 s01.reserve(30);
33 string s02("def");
34 s02.reserve(30);
35 VERIFY( move(s01) + move(s02) == string("abcdef") );
36
37 string s03("abcdefghijklmnopqrstuvw");
38 string s04("xyz");
39 s04.reserve(30);
40 VERIFY( move(s03) + move(s04) == string("abcdefghijklmnopqrstuvwxyz") );
41
42 string s05("abc");
43 s05.reserve(30);
44 string s06("defghijklmnopqrstuvwxyz");
45 VERIFY( move(s05) + move(s06) == string("abcdefghijklmnopqrstuvwxyz") );
46
47 const string sc1("abc");
48 string s07("def");
49 s07.reserve(30);
50 VERIFY( sc1 + move(s07) == string("abcdef") );
51
52 const string sc2("def");
53 string s08("abc");
54 s08.reserve(30);
55 VERIFY( move(s08) + sc2 == string("abcdef") );
56
57 string s09("abc");
58 s09.reserve(30);
59 VERIFY( move(s09) + 'd' == string("abcd") );
60
61 string s10("abc");
62 s10.reserve(30);
63 VERIFY( move(s10) + "def" == string("abcdef") );
64
65 string s11("bcd");
66 s11.reserve(30);
67 VERIFY( 'a' + move(s11) == string("abcd") );
68
69 string s12("def");
70 s12.reserve(30);
71 VERIFY( "abc" + move(s12) == string("abcdef") );
72}
73
74int main()
75{
76 test01();
77 return 0;
78}