]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/ext/vstring/operators/2.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / ext / vstring / operators / 2.cc
1 // 2010-12-19 Paolo Carlini <paolo.carlini@oracle.com>
2 //
3 // Copyright (C) 2010-2018 Free Software Foundation, Inc.
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 //
20 // { dg-do run { target c++11 } }
21 // { dg-require-string-conversions "" }
22
23 #include <ext/vstring.h>
24 #include <testsuite_hooks.h>
25
26 void test01()
27 {
28 using __gnu_cxx::__vstring;
29 using std::move;
30
31 __vstring s01("abc");
32 s01.reserve(30);
33 __vstring s02("def");
34 s02.reserve(30);
35 VERIFY( move(s01) + move(s02) == __vstring("abcdef") );
36
37 __vstring s03("abcdefghijklmnopqrstuvw");
38 __vstring s04("xyz");
39 s04.reserve(30);
40 VERIFY( move(s03) + move(s04) == __vstring("abcdefghijklmnopqrstuvwxyz") );
41
42 __vstring s05("abc");
43 s05.reserve(30);
44 __vstring s06("defghijklmnopqrstuvwxyz");
45 VERIFY( move(s05) + move(s06) == __vstring("abcdefghijklmnopqrstuvwxyz") );
46
47 const __vstring sc1("abc");
48 __vstring s07("def");
49 s07.reserve(30);
50 VERIFY( sc1 + move(s07) == __vstring("abcdef") );
51
52 const __vstring sc2("def");
53 __vstring s08("abc");
54 s08.reserve(30);
55 VERIFY( move(s08) + sc2 == __vstring("abcdef") );
56
57 __vstring s09("abc");
58 s09.reserve(30);
59 VERIFY( move(s09) + 'd' == __vstring("abcd") );
60
61 __vstring s10("abc");
62 s10.reserve(30);
63 VERIFY( move(s10) + "def" == __vstring("abcdef") );
64
65 __vstring s11("bcd");
66 s11.reserve(30);
67 VERIFY( 'a' + move(s11) == __vstring("abcd") );
68
69 __vstring s12("def");
70 s12.reserve(30);
71 VERIFY( "abc" + move(s12) == __vstring("abcdef") );
72 }
73
74 int main()
75 {
76 test01();
77 return 0;
78 }