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