]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/21_strings/basic_string/operators/wchar_t/3.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 21_strings / basic_string / operators / wchar_t / 3.cc
1 // 2010-12-17 Paolo Carlini <paolo.carlini@oracle.com>
2 //
3 // Copyright (C) 2010-2015 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-options "-std=gnu++11" }
21 // { dg-require-string-conversions "" }
22
23 #include <string>
24 #include <testsuite_hooks.h>
25
26 void test01()
27 {
28 bool test __attribute__((unused)) = true;
29 using std::wstring;
30
31 VERIFY( (wstring(L"abc") + wstring(L"def")
32 == wstring(L"abcdef")) );
33 wstring s1(L"abc");
34 VERIFY( s1 + wstring(L"def") == wstring(L"abcdef") );
35 wstring s2(L"def");
36 VERIFY( wstring(L"abc") + s2 == wstring(L"abcdef") );
37 VERIFY( wstring(L"abc") + L'd' == wstring(L"abcd") );
38 VERIFY( wstring(L"abc") + L"def" == wstring(L"abcdef") );
39 VERIFY( L'a' + wstring(L"bcd") == wstring(L"abcd") );
40 VERIFY( L"abc" + wstring(L"def") == wstring(L"abcdef") );
41
42 VERIFY( (wstring(L"abcdefghij") + wstring(L"klmnopqrst")
43 == wstring(L"abcdefghijklmnopqrst")) );
44 wstring s1l(L"abcdefghij");
45 VERIFY( (s1l + wstring(L"klmnopqrst")
46 == wstring(L"abcdefghijklmnopqrst")) );
47 wstring s2l(L"klmnopqrst");
48 VERIFY( (wstring(L"abcdefghij") + s2l
49 == wstring(L"abcdefghijklmnopqrst")) );
50 VERIFY( (wstring(L"abcdefghijklmno") + L'p'
51 == wstring(L"abcdefghijklmnop")) );
52 VERIFY( (wstring(L"abcdefghijklmno") + L"pqrst"
53 == wstring(L"abcdefghijklmnopqrst")) );
54 VERIFY( (L'a' + wstring(L"bcdefghijklmnop")
55 == wstring(L"abcdefghijklmnop")) );
56 VERIFY( (L"abcde" + wstring(L"fghijklmnopqrst")
57 == wstring(L"abcdefghijklmnopqrst")) );
58
59 VERIFY( (wstring(L"abcdefghijklmnopqrst") + wstring(L"uvwxy")
60 == wstring(L"abcdefghijklmnopqrstuvwxy")) );
61 VERIFY( (wstring(L"abcde") + wstring(L"fghijklmnopqrstuvwxy")
62 == wstring(L"abcdefghijklmnopqrstuvwxy")) );
63 wstring s1ll1(L"abcdefghijklmnopqrst");
64 VERIFY( (s1ll1 + wstring(L"uvwxy")
65 == wstring(L"abcdefghijklmnopqrstuvwxy")) );
66 wstring s1ll2(L"abcde");
67 VERIFY( (s1ll2 + wstring(L"fghijklmnopqrstuvwxy")
68 == wstring(L"abcdefghijklmnopqrstuvwxy")) );
69 wstring s2ll1(L"fghijklmnopqrstuvwxy");
70 VERIFY( (wstring(L"abcde") + s2ll1
71 == wstring(L"abcdefghijklmnopqrstuvwxy")) );
72 wstring s2ll2(L"uvwxy");
73 VERIFY( (wstring(L"abcdefghijklmnopqrst") + s2ll2
74 == wstring(L"abcdefghijklmnopqrstuvwxy")) );
75 VERIFY( (wstring(L"abcdefghijklmnopqrst") + L'u'
76 == wstring(L"abcdefghijklmnopqrstu")) );
77 VERIFY( (wstring(L"abcdefghijklmnopqrst") + L"uvwxy"
78 == wstring(L"abcdefghijklmnopqrstuvwxy")) );
79 VERIFY( (wstring(L"abcde") + L"fghijklmnopqrstuvwxy"
80 == wstring(L"abcdefghijklmnopqrstuvwxy")) );
81 VERIFY( (L'a' + wstring(L"bcdefghijklmnopqrstuvwxy")
82 == wstring(L"abcdefghijklmnopqrstuvwxy")) );
83 VERIFY( (L"abcde" + wstring(L"fghijklmnopqrstuvwxy")
84 == wstring(L"abcdefghijklmnopqrstuvwxy")) );
85 VERIFY( (L"abcdefghijklmnopqrst" + wstring(L"uvwxy")
86 == wstring(L"abcdefghijklmnopqrstuvwxy")) );
87 }
88
89 int main()
90 {
91 test01();
92 return 0;
93 }